Example #1
0
function ts_person_func($atts, $content = null)
{
    extract(shortcode_atts(array("id" => 0), $atts));
    global $post;
    $new_post = null;
    if (!empty($id)) {
        $new_post = get_post($id);
    }
    if ($new_post) {
        $old_post = $post;
        $post = $new_post;
        $image = '';
        if (has_post_thumbnail($post->ID, 'post')) {
            $image = ts_get_resized_post_thumbnail($post->ID, 'person-mid');
        }
        $facebook = get_post_meta($post->ID, 'facebook_url', true);
        $twitter = get_post_meta($post->ID, 'twitter_url', true);
        $skype = get_post_meta($post->ID, 'skype_username', true);
        $dribbble = get_post_meta($post->ID, 'dribbble_url', true);
        $youtube = get_post_meta($post->ID, 'youtube_url', true);
        $content = stripslashes($post->post_content);
        $html = '
			<article class="team-member">
				<div class="item-con-t1" style="opacity: 1;">
					<div class="container-t1">
						<div class="container-t1-margin" style="height: 186px;">' . $image . '</div>
					</div>
				</div>
				<h2>' . get_the_title() . '</h2>
				<h3>' . get_post_meta($post->ID, 'team_position', true) . '</h3>
				<hr>
				<p>' . ts_get_shortened_string(strip_tags($content), 30) . '<br/><a class="read-more" href="' . get_permalink($post->ID) . '">' . __('read more', 'circles') . '</a></p>
				<hr>
				<ul class="socials">
					' . (!empty($facebook) ? '<li><span class="tran02slinear"></span><br><a class="facebook tran02slinear" href="' . $facebook . '" target="_blank" title="Facebook"></a></li>' : '') . '
					' . (!empty($twitter) ? '<li><span class="tran02slinear"></span><br><a class="twitter tran02slinear" href="' . $twitter . '" target="_blank" title="Twitter"></a></li>' : '') . '
					' . (!empty($skype) ? '<li><span class="tran02slinear"></span><br><a class="skype tran02slinear" href="skype:' . $skype . '?call" title="Skype"></a></li>' : '') . '
					' . (!empty($dribbble) ? '<li><span class="tran02slinear"></span><br><a class="dribbble tran02slinear" href="' . $dribbble . '" target="_blank" title="Dribble"></a></li>' : '') . '
					' . (!empty($youtube) ? '<li><span class="tran02slinear"></span><br><a class="youtube tran02slinear" href="' . $youtube . '" target="_blank" title="Youtube"></a></li>' : '') . '
				</ul>
			</article>';
        $post = $old_post;
    }
    return $html;
}
    function widget($args, $instance)
    {
        global $post;
        $cache = wp_cache_get('widget_latest_posts_entries', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        echo $before_widget;
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Popular Posts', "framework") : $instance['title'], $instance, $this->id_base);
        if (empty($instance['number']) || !($number = absint($instance['number']))) {
            $number = 10;
        }
        $r = new WP_Query(apply_filters('widget_posts_args', array('orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true)));
        if ($r->have_posts()) {
            ?>
			<?php 
            echo $before_title . $title . $after_title;
            ?>
			<?php 
            $posts_sz = count($r->posts);
            ?>
			<?php 
            $i = 1;
            ?>
			<ul class="latest-posts">
				<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
				<li>
					<div class="latest-desc">
						<div class="latest-meta">
							<div class="latest-date"><?php 
                the_time(get_option('date_format'));
                ?>
</div>
							<div class="latest-author"><?php 
                _e('By', 'circles');
                ?>
 <?php 
                the_author_link();
                ?>
</div>
						</div>
						<h3><a title="<?php 
                echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
                ?>
" href="<?php 
                the_permalink();
                ?>
"><?php 
                if (get_the_title()) {
                    echo ts_get_shortened_string(get_the_title(), 6);
                } else {
                    the_ID();
                }
                ?>
</a></h3>
						<div class="latest-excerpts"><?php 
                ts_the_excerpt_theme('tiny');
                ?>
</div>
					</div>
					<div class="clear"></div>
				</li>
				<?php 
                $i++;
                ?>
				<?php 
            }
            ?>
			</ul>
			<?php 
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_postdata();
        }
        //have_posts()
        echo $after_widget;
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('widget_latest_posts_entries', $cache, 'widget');
    }
    function widget($args, $instance)
    {
        global $comment;
        $cache = wp_cache_get('widget_multi_posts_entries', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (!isset($args['widget_id'])) {
            $args['widget_id'] = $this->id;
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        echo $before_widget;
        $rand = rand(15000, 50000);
        ?>
		<div id='tab-<?php 
        echo $rand;
        ?>
' class="multi-post underline">
			<ul>
				<li><a><?php 
        _e('Popular', 'framework');
        ?>
</a></li>
				<li><a><?php 
        _e('Recent', 'framework');
        ?>
</a></li>
				<li><a><?php 
        _e('Comments', 'framework');
        ?>
</a></li>
			</ul>
			<div>
				<div class='widget_bookmark_content'>
					<?php 
        $number = 3;
        $r = new WP_Query(apply_filters('widget_posts_args', array('orderby' => 'comment_count DESC', 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true)));
        if ($r->have_posts()) {
            ?>
						<?php 
            $posts_sz = count($r->posts);
            ?>
						<?php 
            $i = 0;
            ?>
							<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
								<div class='widget_bookmark_content_item'>
									<span class="widget_bookmark_date"><?php 
                the_time(get_option('date_format'));
                ?>
</span> <span class="widget_bookmark_separator">|</span>
									<span class="widget_bookmark_author">
										<?php 
                _e('By', 'circles');
                ?>
										<span>
											<?php 
                the_author_posts_link();
                ?>
										</span>
									</span>
									<a title="<?php 
                echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
                ?>
" href="<?php 
                the_permalink();
                ?>
"><?php 
                if (get_the_title()) {
                    echo ts_get_shortened_string(get_the_title(), 5);
                } else {
                    the_ID();
                }
                ?>
</a>
									<?php 
                ts_the_excerpt_theme(8);
                ?>
								</div>
								<?php 
                if ($i < 2) {
                    ?>
									<div class='g-line'></div>
								<?php 
                }
                ?>
								<?php 
                $i++;
                ?>
							<?php 
            }
            ?>
						<?php 
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_postdata();
        }
        //have_posts()
        ?>
				</div>

				<div class='widget_bookmark_content'>
					<?php 
        $number = 3;
        $r = new WP_Query(apply_filters('widget_posts_args', array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true)));
        if ($r->have_posts()) {
            ?>
						<?php 
            $posts_sz = count($r->posts);
            ?>
						<?php 
            $i = 0;
            ?>
							<?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>
								<div class='widget_bookmark_content_item'>
									<span class="widget_bookmark_date"><?php 
                the_time(get_option('date_format'));
                ?>
</span> <span class="widget_bookmark_separator">|</span>
									<span class="widget_bookmark_author">
										<?php 
                _e('By', 'circles');
                ?>
										<span>
											<?php 
                the_author_posts_link();
                ?>
										</span>
									</span>
									<a title="<?php 
                echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
                ?>
" href="<?php 
                the_permalink();
                ?>
"><?php 
                if (get_the_title()) {
                    echo ts_get_shortened_string(get_the_title(), 5);
                } else {
                    the_ID();
                }
                ?>
</a>
									<?php 
                ts_the_excerpt_theme(8);
                ?>
								</div>
								<?php 
                if ($i < 2) {
                    ?>
									<div class='g-line'></div>
								<?php 
                }
                ?>
								<?php 
                $i++;
                ?>
							<?php 
            }
            ?>
						<?php 
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_postdata();
        }
        //have_posts()
        ?>
				</div>
				<div class='widget_bookmark_content'>
					<?php 
        $number = 3;
        $comments = get_comments(apply_filters('widget_comments_args', array('number' => $number, 'status' => 'approve', 'post_status' => 'publish')));
        $i = 0;
        if ($comments) {
            foreach ((array) $comments as $comment) {
                ?>
							<div class='widget_bookmark_content_item'>
								<span class="widget_bookmark_date"><?php 
                echo comment_time(get_option('date_format'), $comment->comment_ID);
                ?>
</span>
								<a href='<?php 
                echo esc_url(get_comment_link($comment->comment_ID));
                ?>
'><?php 
                echo ts_get_shortened_string($comment->comment_content, 5);
                ?>
</a>
							</div>
							<?php 
                if ($i < 2) {
                    ?>
								<div class='g-line'></div>
							<?php 
                }
                ?>
							<?php 
                $i++;
                ?>
							<?php 
            }
        }
        ?>
				</div>
			</div>
		</div>
		<script>
			jQuery(document).ready(function(){
				jQuery('#tab-<?php 
        echo $rand;
        ?>
').zozoTabs({
					theme: 'silver'
				});
			});
		</script>
		<?php 
        echo $after_widget;
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('widget_multi_posts_entries', $cache, 'widget');
    }