Esempio n. 1
0
    /**
     * Displaying the widget
     *
     * Handle the display of the widget
     * @param array
     * @param array
     */
    function widget($args, $instance)
    {
        extract($args);
        global $wp_query;
        /* Before widget(defined by theme)*/
        echo $before_widget;
        $query = array();
        if (!empty($instance['number_of_posts'])) {
            $query['showposts'] = $instance['number_of_posts'];
        } else {
            $query['showposts'] = 1;
        }
        $formats = get_post_format_slugs();
        foreach ((array) $formats as $i => $format) {
            $formats[$i] = 'post-format-' . $format;
        }
        $query['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => $formats, 'operator' => 'NOT IN'));
        /* START Widget body */
        //if ( isset( $instance['title'] ) ) echo $before_title . $instance['title'] . $after_title;
        if (!empty($instance['title'])) {
            echo $before_title;
            echo do_shortcode($instance['title']);
            echo $after_title;
        }
        $i = 1;
        $num_posts = sizeof(query_posts($query));
        if (have_posts()) {
            ?>
        <div class="postitems-wrapper">
         <?php 
            while (have_posts()) {
                the_post();
                if (!empty($instance['excerpt_length'])) {
                    if (function_exists('iconv')) {
                        $text = iconv_substr(strip_tags(get_the_content()), 0, $instance['excerpt_length'], 'UTF-8');
                    } else {
                        $text = substr(strip_tags(get_the_content()), 0, $instance['excerpt_length']);
                    }
                } else {
                    $text = get_the_excerpt();
                }
                $thumbnail_id = get_post_thumbnail_id(get_the_ID());
                $thumbnail_args = wp_get_attachment_image_src($thumbnail_id, 'single-post-thumbnail');
                switch ($instance['thumbnail_position']) {
                    case 'left':
                        $thumbnail_class = 'fl';
                        break;
                    case 'right':
                        $thumbnail_class = 'fr';
                        break;
                    default:
                        $thumbnail_class = '';
                        break;
                }
                $post_class = '';
                // Is last post
                if ($i == $num_posts) {
                    $post_class = ' last';
                }
                // Has thumbnail
                if (has_post_thumbnail(get_the_ID()) && $instance['show_thumbnails']) {
                    $post_class .= ' with-thumbnail';
                }
                ?>
                <div class="postitem clearfix <?php 
                echo $post_class;
                ?>
">
                <?php 
                if (has_post_thumbnail(get_the_ID()) && $instance['show_thumbnails']) {
                    ?>

                    <div class="thumb-wrap <?php 
                    echo $thumbnail_class;
                    ?>
">

                        <a href="<?php 
                    the_permalink();
                    ?>
" class="greyscale">

							<?php 
                    if (TIMTHUMB_URL != '') {
                        ?>
							<img class="thumb" src="<?php 
                        echo TIMTHUMB_URL;
                        ?>
?src=<?php 
                        echo getRealThumbnailUrl($thumbnail_args['0']);
                        ?>
&amp;w=<?php 
                        echo $instance['thumbnail_width'];
                        ?>
&amp;h=<?php 
                        echo $instance['thumbnail_height'];
                        ?>
" alt="" />
                            <?php 
                    } else {
                        ?>
                            <img class="thumb" src="<?php 
                        echo AitImageResizer::resize($thumbnail_args['0'], array('w' => $instance['thumbnail_width'], 'h' => $instance['thumbnail_height']));
                        ?>
" alt="" />
                            <?php 
                    }
                    ?>
                        </a>
                    </div><!-- /.thumb-wrap -->
                <?php 
                }
                ?>

                <h3><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title_attribute();
                ?>
</a></h3>

                <p><small><?php 
                echo $text;
                ?>
</small></p>

                <?php 
                if (!empty($instance['show_read_more'])) {
                    ?>
                <div class="read-more">
                    <small class="fl">
                        <strong><?php 
                    echo get_the_date();
                    ?>
</strong>
                    </small>

                    <small class="fr">
                        <a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    echo __('read more', 'ait');
                    ?>
</a>
                    </small>
                </div>
                <?php 
                }
                ?>
            </div><!-- /.item -->
            <?php 
                $i++;
            }
            ?>
</div><?php 
        } else {
            ?>
        	<div class="postitems-wrapper">
           		<?php 
            echo __('<div class="no-content">No posts</div>');
            ?>
           </div>
        <?php 
        }
        /* After widget(defined by theme)*/
        echo $after_widget;
        wp_reset_query();
    }
Esempio n. 2
0
         $basename = basename($example, '.html');
         $parts = explode('-', $basename);
         $id = $parts[3];
         preg_match("<!--(.*?)-->", file_get_contents($example), $match);
         $desc = isset($match[1]) ? esc_attr(trim(str_replace("@description: ", "", $match[1]))) : "";
         echo '<tr>';
         $ext = '';
         if (file_exists("{$examplesDir}/{$basename}.jpg")) {
             $ext = 'jpg';
         } elseif (file_exists("{$examplesDir}/{$basename}.png")) {
             $ext = 'png';
         } else {
             $ext = 'gif';
         }
         echo '<th style="margin:0px; padding:0px; width: 300px; vertical-align: top; height: 0px;">';
         printf('<label style="margin-bottom:10px;display:block;"><input type="radio" name="ait-econtent-choose" value="%1$d" class="%2$s" data-image="%3$s" data-alt="%4$s" data-title="%4$s">&nbsp; %5$s %1$d<br><small>%4$s</small><label>', $id, isset($value['css']) ? 'type-' . $value['css'] : '', TIMTHUMB_URL ? TIMTHUMB_URL . "?src={$examplesUrl}/{$basename}.{$ext}&w=200" : AitImageResizer::resize("{$examplesUrl}/{$basename}.{$ext}", array('w' => 200)), $desc, ucfirst($parts[2]));
         echo '</th>';
         if ($i == 0) {
             echo '<td rowspan="' . count($examples) . '"><div id="ait-econtent-preview" style="width: 200px; overflow: hidden"><img style="display: none;" src=" " alt=" " title=" " width="200px"/></div></td>';
         } else {
             echo '</tr>';
         }
         $i++;
     }
 } else {
     echo '<tr>';
     echo '<td colspan="2">';
     echo 'No examples found';
     echo '</td>';
     echo '</tr>';
 }
Esempio n. 3
0
function ait_portfolio($params)
{
    extract(shortcode_atts(array('slug' => 'all', 'cat_id' => 0, 'width' => '', 'height' => '', 'showdescription' => '', 'cols' => '1'), $params));
    if ($cat_id != 0) {
        $args = array('numberposts' => 500, 'post_type' => 'ait-portfolio', 'orderby' => 'menu_order', 'order' => 'ASC', 'suppress_filters' => false, 'tax_query' => array(array('taxonomy' => 'ait-portfolio-category', 'field' => 'id', 'terms' => $cat_id)));
    } else {
        $args = array('numberposts' => 500, 'post_type' => 'ait-portfolio', 'orderby' => 'menu_order', 'order' => 'ASC', 'suppress_filters' => false, 'category' => $cat_id);
    }
    if ($cols > 4) {
        $cols = 1;
    }
    $portfolio_images = get_posts($args);
    $class = "ait-portfolio";
    $descrAdd = "";
    if (!empty($showdescription)) {
        if ($showdescription == "down") {
            $class .= " desc-down";
        }
        if ($showdescription == "right") {
            $class .= " desc-right";
            $descrAdd = 'style="margin-left: ' . ($width + 4) . 'px;"';
        }
    }
    $class .= " pf-col" . $cols;
    $result = '<div class="' . $class . '">';
    $count = count($portfolio_images);
    $i = 0;
    foreach ($portfolio_images as $key => $post_image) {
        //$author = get_the_author_meta('nickname', $post_image->post_author );
        //$post_link = get_permalink( $post_image->ID );
        //$date = mysql2date(get_option('date_format'), $post_image->post_date);
        //$category = get_the_category_list( ', ', $parents = '', $post_image->ID );
        $result .= '<div class="pf-page"><div class="item clearfix">';
        // ITEM LINK
        $meta = get_post_meta($post_image->ID, '_ait-portfolio', TRUE);
        if (is_string($meta) and empty($meta)) {
            $meta = array();
        }
        $item_link = '';
        $item_type = '';
        if (isset($meta['itemType']) and $meta['itemType'] == "image") {
            $item_link = $meta['imageLink'];
            $item_type = 'image-type';
        } elseif (isset($meta['itemType']) and $meta['itemType'] == "website") {
            $item_link = $meta['websiteLink'];
            $item_type = 'website-type';
        } elseif (isset($meta['itemType']) and $meta['itemType'] == "video") {
            $item_link = $meta['videoLink'];
            $item_type = 'video-type';
        }
        // ITEM GROUP - CATEGORY
        $itemGroup = "group-";
        if ($cat_id != '') {
            $itemGroup .= $cat_id;
        } else {
            $itemGroup .= $slug;
        }
        // ITEM THUMBNAIL
        if (get_the_post_thumbnail($post_image->ID)) {
            $result .= '<div class="image" style="width: ' . ($width + 4) . 'px;">';
            if ($width != "" && $height != "") {
                $result .= '<a data-rel="' . $itemGroup . '" class="zoom ' . $item_type . '" href="' . $item_link . '" style="line-height:' . $height . 'px; width:' . $width . 'px; height:' . $height . 'px;">';
                $thumbnail_id = get_post_thumbnail_id($post_image->ID);
                $thumbnail_args = wp_get_attachment_image_src($thumbnail_id, 'large');
                if (TIMTHUMB_URL) {
                    $result .= '<img width="' . $width . '" height="' . $height . '" src="' . TIMTHUMB_URL . '?src=' . $thumbnail_args['0'] . '&amp;w=' . $width . '&amp;h=' . $height . '" alt="" />';
                } else {
                    $result .= '<img width="' . $width . '" height="' . $height . '" src="' . AitImageResizer::resize($thumbnail_args['0'], array('w' => $width, 'h' => $height)) . '" alt="" />';
                }
            } else {
                $result .= '<a data-rel="' . $itemGroup . '" class="zoom ' . $item_type . '" href="' . $item_link . '" style="line-height:150px;" width:150px; height:150px;">';
                $thumbnail_id = get_post_thumbnail_id($post_image->ID);
                $thumbnail_args = wp_get_attachment_image_src($thumbnail_id, 'large');
                if (TIMTHUMB_URL) {
                    $result .= '<img width="150" height="150" src="' . TIMTHUMB_URL . '?src=' . $thumbnail_args['0'] . '&amp;w=150&amp;h=150" alt="" />';
                } else {
                    $result .= '<img width="150" height="150" src="' . AitImageResizer::resize($thumbnail_args['0'], array('w' => 150, 'h' => 150)) . '" alt="" />';
                }
            }
            $result .= '</a>';
            if (!empty($showdescription) && ($showdescription == "right" || $showdescription == "down")) {
                $result .= '<script class="image-description" type="text/template"></script>';
                $result .= '<h3 ' . $descrAdd . '>' . $meta['itemTitle'] . '</h3>';
                if (!empty($meta['itemDescription'])) {
                    $result .= '<div class="portfolio-item-description" ' . $descrAdd . '>' . $meta['itemDescription'] . '</div>';
                }
            } else {
                if (isset($meta['itemTitle'])) {
                    $result .= '<script class="image-description" type="text/template">' . $meta['itemTitle'] . '</script>';
                } else {
                    $result .= '<script class="image-description" type="text/template"></script>';
                }
            }
            $result .= '</div>';
        }
        $result .= '</div></div>';
        $i++;
        if ($cols && $i % $cols == 0) {
            $result .= '<div class="pf-clear"></div>';
        }
    }
    $result .= '</div><!-- end of .ait-portfolio -->';
    wp_reset_query();
    return $result;
}
Esempio n. 4
0
function aitsliderCreatorCustomColumns($column, $post_id)
{
    global $sliderCreatorOptions;
    $options = $sliderCreatorOptions->the_meta();
    switch ($column) {
        case "slider_type":
            if (isset($options['itemType'])) {
                echo $options['itemType'];
            } else {
                echo "Image";
            }
            break;
        case "slider_top_img":
            if (!empty($options['slideType']) && $options['slideType'] == 'advanced') {
                switch ($options['advancedItemType']) {
                    case "image":
                        if (isset($options['advancedImageSource'])) {
                            if (TIMTHUMB_URL) {
                                echo '<img src="' . TIMTHUMB_URL . '?src=' . $options['advancedImageSource'] . '&w=100&h=100" alt="" />';
                            } else {
                                echo '<img src="' . AitImageResizer::resize($options['advancedImageSource'], array('w' => 100, 'h' => 100)) . '" alt="" />';
                            }
                        }
                        break;
                    case "video":
                        if (isset($options['advancedVideoPreview'])) {
                            if (TIMTHUMB_URL) {
                                echo '<img src="' . TIMTHUMB_URL . '?src=' . $options['advancedVideoPreview'] . '&w=100&h=100" alt="" />';
                            } else {
                                echo '<img src="' . AitImageResizer::resize($options['advancedVideoPreview'], array('w' => 100, 'h' => 100)) . '" alt="" />';
                            }
                        }
                        break;
                    case "flash":
                        if (isset($options['advancedSwfPreview'])) {
                            if (TIMTHUMB_URL) {
                                echo '<img src="' . TIMTHUMB_URL . '?src=' . $options['advancedSwfPreview'] . '&w=100&h=100" alt="" />';
                            } else {
                                echo '<img src="' . AitImageResizer::resize($options['advancedSwfPreview'], array('w' => 100, 'h' => 100)) . '" alt="" />';
                            }
                        }
                        break;
                }
            } else {
                if (!empty($options['topImage'])) {
                    if (TIMTHUMB_URL) {
                        echo '<img src="' . TIMTHUMB_URL . '?src=' . $options['topImage'] . '&w=100&h=100" alt="" />';
                    } else {
                        echo '<img src="' . AitImageResizer::resize($options['topImage'], array('w' => 100, 'h' => 100)) . '" alt="" />';
                    }
                }
            }
            break;
        case "slider_back_img":
            if (!empty($options['backgroundImage'])) {
                if (TIMTHUMB_URL) {
                    echo '<img src="' . TIMTHUMB_URL . '?src=' . $options['backgroundImage'] . '&w=100&h=100" alt="" />';
                } else {
                    echo '<img src="' . AitImageResizer::resize($options['backgroundImage'], array('w' => 100, 'h' => 100)) . '" alt="" />';
                }
            }
            break;
        case "slider_link":
            if (!empty($options['itemType']) && $options['itemType'] == "video") {
                echo $options['videoUrl'];
            } else {
                echo $options['link'];
            }
            break;
    }
}
Esempio n. 5
0
function get_category_items($params)
{
    extract(shortcode_atts(array('number' => '1', 'category' => '1', 'excerpt' => 290, 'display' => '1', 'readmore' => 'no', 'readmoretext' => 'Read more'), $params));
    $latest_posts = query_posts(array('post_type' => 'ait-item', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => $number, 'tax_query' => array(array('taxonomy' => 'ait-item-category', 'field' => 'id', 'terms' => $category))));
    wp_reset_query();
    if ($display == "1") {
        // type 1 -> like normal rooms loop
        $result = '<section id="rooms" class="clear">';
        $count = count($latest_posts);
        foreach ($latest_posts as $key => $latest_post) {
            $author = get_the_author_meta('nickname', $latest_post->post_author);
            $post_link = get_permalink($latest_post->ID);
            $date = mysql2date(get_option('date_format'), $latest_post->post_date);
            $category = get_the_category_list(', ', $parents = '', $latest_post->ID);
            $result .= '<div class="item clearfix shortcodeCustomType">';
            // POST THUMBNAIL
            if (has_post_thumbnail($latest_post->ID)) {
                $result .= '<article class="ait-room type-ait-room status-publish hentry thumbnail pf-page">';
                $result .= '<header class="entry-header">';
                $result .= '<div class="entry-thumbnail">';
                $result .= '<div class="entry-thumb-img">';
                $result .= '<a href="' . $post_link . '">';
                if (TIMTHUMB_URL) {
                    $result .= '<img src="' . TIMTHUMB_URL . '?src=' . wp_get_attachment_url(get_post_thumbnail_id($latest_post->ID)) . '&amp;w=309&amp;h=120" alt="' . $latest_post->post_title . '" />';
                } else {
                    $result .= '<img src="' . AitImageResizer::resize(wp_get_attachment_url(get_post_thumbnail_id($latest_post->ID)), array('w' => 309, 'h' => 120)) . '" alt="' . $latest_post->post_title . '" />';
                }
                $result .= '</a>';
                $result .= '</div>';
                $result .= '</div>';
                $result .= '</header>';
                $result .= '<h2 class="entry-title"><a href="' . $post_link . '" title="Permalink to ' . $latest_post->post_title . '" rel="Bookmark">' . $latest_post->post_title . '</a></h2>';
                if (is_search()) {
                    $result .= '<div class="entry-summary">';
                    $result .= $latest_post->post_excerpt;
                    $result .= '</div>';
                } else {
                    $result .= '<div class="entry-content thumbnail">';
                    if ($latest_post->post_excerpt != "") {
                        $result .= $latest_post->post_excerpt;
                    } else {
                        $result .= "";
                    }
                    $result .= '</div>';
                }
                $result .= '</article>';
            } else {
                $result .= '<article class="no-thumbnail pf-page">';
                $result .= '<header class="entry-header"></header>';
                $result .= '<h2 class="entry-title no-thumbnail"><a href="' . $post_link . '" title="Permalink to ' . $latest_post->post_title . '" rel="Bookmark">' . $latest_post->post_title . '</a></h2>';
                if (is_search()) {
                    $result .= '<div class="entry-summary">';
                    $result .= $latest_post->post_excerpt;
                    $result .= '</div>';
                } else {
                    $result .= '<div class="entry-content no-thumbnail">';
                    if ($latest_post->post_excerpt != "") {
                        $result .= $latest_post->post_excerpt;
                    } else {
                        $result .= "";
                    }
                    $result .= '</div>';
                }
                $result .= '</article>';
            }
            $result .= '</div>';
        }
        $result .= '</section>';
    } else {
        // type 2 -> default post display
        $result = '<div class="latest-posts">';
        $count = count($latest_posts);
        foreach ($latest_posts as $key => $latest_post) {
            $author = get_the_author_meta('nickname', $latest_post->post_author);
            $post_link = get_permalink($latest_post->ID);
            $date = mysql2date(get_option('date_format'), $latest_post->post_date);
            $category = get_the_category_list(', ', $parents = '', $latest_post->ID);
            $result .= '<div class="sc-page"><div class="item clearfix">';
            // POST THUMBNAIL
            if (get_the_post_thumbnail($latest_post->ID, 'thumbnail')) {
                $result .= '<div class="image">';
                $result .= '<a href="' . $post_link . '" class="greyscale">';
                $result .= get_the_post_thumbnail($latest_post->ID, 'thumbnail');
                $result .= '</a>';
                $result .= '</div>';
            }
            // POST BODY
            $result .= '<div class="text">';
            $result .= '<div class="title"><h3><a href="' . $post_link . '">' . $latest_post->post_title . '</a></h3></div>';
            if ($latest_post->post_excerpt) {
                $result .= '<p>' . $latest_post->post_excerpt . '</p>';
            } else {
                $limit = $excerpt;
                $my_text = substr($latest_post->post_content, 0, $limit);
                $pos = strrpos($my_text, " ");
                $my_post_text = substr($my_text, 0, $pos ? $pos : -1) . "...";
                $read = "";
                if ($readmore == 'yes') {
                    $read = '&nbsp;<a href="' . $post_link . '">' . $readmoretext . '</a>';
                }
                $result .= '<p>' . strip_tags($my_post_text) . $read . '</p>';
                //$result .= '<p>' . substr_replace( $latest_post['0']->post_content, '...', 350 ) . '</p>';
            }
            $result .= '</div><!-- /.text -->';
            if ($count - 1 != $key) {
                $result .= do_shortcode('[rule]');
            }
            $result .= '</div></div>';
        }
        $result .= '</div>';
    }
    return $result;
}
Esempio n. 6
0
function get_category_teams($params)
{
    extract(shortcode_atts(array('category' => '1', 'number' => '1', 'icons' => 'yes'), $params));
    global $teamOptions;
    $result = '';
    $members = query_posts(array('post_type' => 'ait-team', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => $number, 'tax_query' => array(array('taxonomy' => 'ait-team-category', 'field' => 'id', 'terms' => $category))));
    $counter = 0;
    $result .= '<div class="ait-teams">';
    foreach ($members as $member) {
        $thumbnail = wp_get_attachment_url(get_post_thumbnail_id($member->ID));
        $options = $teamOptions->the_meta($member->ID);
        /* RENDER STARTED */
        if ($counter % 3 == 0 && $counter != 0) {
            $result .= '<div class="single-member sc-column sc-column-last one-fourth-last">';
        } else {
            $result .= '<div class="single-member sc-column one-fourth">';
        }
        $result .= '<div class="cssfeature scale">';
        $result .= '<div class="border-light-thin image-wrap grey-bg">';
        if (isset($options['link'])) {
            $result .= '<a href="' . $options['link'] . '" class="block cboxElement"><img src="' . AitImageResizer::resize($thumbnail, array('w' => 217, 'h' => 163)) . '" alt="' . $member->post_title . '" title="' . $member->post_title . '" class="alignnone block clearmargin size-full"></a>';
        } else {
            $result .= '<a href="' . $thumbnail . '" class="block cboxElement"><img src="' . AitImageResizer::resize($thumbnail, array('w' => 217, 'h' => 163)) . '" alt="' . $member->post_title . '" title="' . $member->post_title . '" class="alignnone block clearmargin size-full"></a>';
        }
        if ($icons == "yes") {
            $result .= '<div class="lawyer-buttons social-buttons">';
            $result .= '<div class="social-holder" style="text-align: center; margin: 13px 0 8px;">';
            for ($i = 1; $i < 8; $i++) {
                if (isset($options['socialIcon' . $i . 'Image']) && !empty($options['socialIcon' . $i . 'Image'])) {
                    $result .= '<a href="' . $options['socialIcon' . $i . 'Link'] . '"><img src="' . $options['socialIcon' . $i . 'Image'] . '" class="social-button inline-block" style="margin: 0 5px 0 5px;" alt=""></a>';
                }
            }
            $result .= '</div>';
            $result .= '</div>';
        }
        $result .= '</div>';
        $result .= '<div class="member-name" style="text-align: center">';
        $result .= '<h3 style="margin: 10px 0 3px;">' . $member->post_title . '</h3>';
        $result .= '<p><span class="fancyFont" style="font-size: 14px; color: #444;">' . $options['specialization'] . '</span></p>';
        $result .= '</div>';
        $result .= '</div>';
        $result .= '</div>';
        /* RENDER ENDED */
        $counter++;
    }
    $result .= '</div>';
    wp_reset_query();
    return $result;
}