function widget($args, $instance)
    {
        // Turn $args array into variables.
        extract($args);
        // $instance Defaults
        $instance_defaults = $this->defaults;
        // Parse $instance
        $instance = wp_parse_args($instance, $instance_defaults);
        // Widget Settings
        $title = !empty($instance['title']) ? $instance['title'] : '';
        $recent_posts_number = !empty($instance['recent_posts_number']) ? absint($instance['recent_posts_number']) : 5;
        $hide_recent_thumbs = !empty($instance['hide_recent_thumbs']) ? '1' : '0';
        echo $before_widget;
        // Widget Front End Output
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $args = array('posts_per_page' => $recent_posts_number, 'ignore_sticky_posts' => 1);
        $wp_query = new WP_Query();
        $wp_query->query($args);
        $count = 0;
        ?>
		<ul class="ac-recent-posts">
			<?php 
        if ($wp_query->have_posts()) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                $count++;
                ?>
			<li class="clearfix<?php 
                if ($hide_recent_thumbs) {
                    echo ' full-width';
                }
                ?>
">
				<?php 
                if (!$hide_recent_thumbs) {
                    ?>
				<figure class="thumbnail">
					<?php 
                    if (has_post_thumbnail()) {
                        the_post_thumbnail('ac-sidebar-small-thumbnail');
                    } else {
                        echo '<img src="' . get_template_directory_uri() . '/images/no-thumbnail.png" alt="' . __('No Thumbnail', 'justwrite') . '" class="no-thumbnail" />';
                    }
                    ?>
				</figure>
				<?php 
                }
                ?>
				<div class="details">
					<span class="category"><?php 
                ac_output_first_category();
                ?>
</span>
					<?php 
                the_title('<a href="' . esc_url(get_permalink()) . '" class="title" rel="bookmark">', '</a>');
                ?>
					<a href="<?php 
                comments_link();
                ?>
" class="comments-number"><?php 
                ac_comments_number();
                ?>
</a>
				</div>
			</li>
			<?php 
            }
        } else {
            ?>
			<li><?php 
            _e('No popular posts available!', 'justwrite');
            ?>
</li>
			<?php 
        }
        wp_reset_postdata();
        ?>
		</ul>
		<?php 
        echo $after_widget;
    }
示例#2
0
"><?php 
echo get_the_date('M d, Y');
?>
</time>
			<span class="detail left index-post-author"><em><?php 
_e('by', 'justwrite');
?>
</em> <?php 
the_author_posts_link();
?>
</span>
			<span class="detail left index-post-category"><em><?php 
_e('in', 'justwrite');
?>
</em> <?php 
ac_output_first_category();
?>
</span>
        </header><!-- END .details -->
        <?php 
if ($show_thumbnail && ac_check_paged()) {
    ?>
        <figure class="featured-image-wrap">
        	<?php 
    if (has_post_thumbnail() && $paged == false) {
        the_post_thumbnail('ac-sidebar-featured');
    } else {
        echo '<img src="' . get_template_directory_uri() . '/images/no-thumbnail.png" alt="' . __('No Thumbnail', 'justwrite') . '" />';
    }
    ?>
        </figure>
    function widget($args, $instance)
    {
        // Turn $args array into variables.
        extract($args);
        // $instance Defaults
        $instance_defaults = $this->defaults;
        // Parse $instance
        $instance = wp_parse_args($instance, $instance_defaults);
        // Widget Settings
        $title = !empty($instance['title']) ? $instance['title'] : '';
        $popular_posts_number = !empty($instance['popular_posts_number']) ? absint($instance['popular_posts_number']) : 3;
        echo $before_widget;
        // Widget Front End Output
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $args = array('orderby' => 'comment_count', 'posts_per_page' => $popular_posts_number, 'ignore_sticky_posts' => 1);
        $wp_query = new WP_Query();
        $wp_query->query($args);
        $count = 0;
        ?>
		<ul class="ac-popular-posts">
			<?php 
        if ($wp_query->have_posts()) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                $count++;
                $mcn = get_comments_number();
                $ncn = get_comments_number();
                if ($count == 1) {
                    $max_comments_number = $mcn;
                }
                if ($ncn != 0) {
                    $make_percent = number_format(100 * $ncn / $max_comments_number);
                    ?>
			<li>
				<span class="position"><?php 
                    echo $count;
                    ?>
</span>
				<div class="details">
					<span class="category"><?php 
                    ac_output_first_category();
                    ?>
</span>
					<?php 
                    the_title('<a href="' . esc_url(get_permalink()) . '" class="title" rel="bookmark">', '</a>');
                    ?>
					<div class="the-percentage" style="width: <?php 
                    echo $make_percent;
                    ?>
%"></div>
					<a href="<?php 
                    comments_link();
                    ?>
" class="comments-number"><?php 
                    ac_comments_number();
                    ?>
</a>
				</div>
			</li>
			<?php 
                }
            }
        } else {
            ?>
               <li><?php 
            _e('No popular posts available!', 'justwrite');
            ?>
</li>
			<?php 
        }
        wp_reset_postdata();
        ?>
		</ul>
		<?php 
        echo $after_widget;
    }
    function widget($args, $instance)
    {
        // Turn $args array into variables.
        extract($args);
        // $instance Defaults
        $instance_defaults = $this->defaults;
        // Parse $instance
        $instance = wp_parse_args($instance, $instance_defaults);
        // Widget Settings
        $title = !empty($instance['title']) ? $instance['title'] : '';
        $featured_posts_number = !empty($instance['featured_posts_number']) ? absint($instance['featured_posts_number']) : 3;
        echo $before_widget;
        // Widget Front End Output
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $args = array('posts_per_page' => $featured_posts_number, 'meta_key' => 'ac_featured_article', 'meta_value' => 1, 'ignore_sticky_posts' => 1);
        $wp_query = new WP_Query();
        $wp_query->query($args);
        $count = 0;
        ?>
		<ul class="ac-featured-posts">
			<?php 
        if ($wp_query->have_posts()) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                $count++;
                ?>
			<li id="featured-post-<?php 
                echo $count;
                ?>
">
				<figure class="thumbnail<?php 
                if (!has_post_thumbnail()) {
                    echo ' no-thumbnail';
                }
                ?>
">
					<?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail('ac-sidebar-featured');
                } else {
                    echo '<img src="' . get_template_directory_uri() . '/images/no-thumbnail.png" alt="' . __('No Thumbnail', 'justwrite') . '" />';
                }
                ?>
					<figcaption class="details">
						<span class="category"><?php 
                ac_output_first_category();
                ?>
</span>
						<?php 
                the_title('<a href="' . esc_url(get_permalink()) . '" class="title" rel="bookmark">', '</a>');
                ?>
						<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                _e('Read More', 'justwrite');
                ?>
" class="read-more"><?php 
                ac_icon('ellipsis-h fa-lg');
                ?>
</a>
					</figcaption>
				</figure>
			</li>
			<?php 
            }
        }
        wp_reset_postdata();
        ?>
		</ul>
		<?php 
        echo $after_widget;
    }
示例#5
0
                ?>
                        <?php 
                if ($sau && ($section_type != 'posts' && $section_type != 'featured')) {
                    ?>
<a href="<?php 
                    echo esc_url(get_author_posts_url(get_the_author_meta('ID')));
                    ?>
" class="category"><?php 
                    echo esc_html(get_the_author());
                    ?>
</a><?php 
                }
                ?>
                        <?php 
                if ($sca && $section_type != 'category') {
                    ac_output_first_category('category');
                }
                ?>
                    </aside>
                    <?php 
            }
            ?>
                    <?php 
            the_title('<h4 class="section-title st-wrapped st-small st-bold"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h4>');
            ?>
                </div>	
            </figcaption>
        </figure>     
    </div><!-- END .col-large -->
    
    <?php 
    function widget($args, $instance)
    {
        extract($args);
        // Widget Settings
        $show_popular_posts = isset($instance['show_popular_posts']) ? $instance['show_popular_posts'] : false;
        $show_featured_posts = isset($instance['show_featured_posts']) ? $instance['show_featured_posts'] : false;
        $show_recent_posts = isset($instance['show_recent_posts']) ? $instance['show_recent_posts'] : false;
        $show_recent_comments = isset($instance['show_recent_comments']) ? $instance['show_recent_comments'] : false;
        $show_tags = isset($instance['show_tags']) ? $instance['show_tags'] : false;
        // How Many Posts Settings
        $popular_posts_number = $instance['popular_posts_number'];
        $featured_posts_number = $instance['featured_posts_number'];
        $recent_posts_number = $instance['recent_posts_number'];
        $recent_comments_number = $instance['recent_comments_number'];
        // Hide thumbnails
        $hide_recent_thumbs = isset($instance['hide_recent_thumbs']) ? $instance['hide_recent_thumbs'] : false;
        // Widget Front End Output
        echo '<aside class="side-box ac-tabs-init-wrap widget" id="ac-tabs-widget-' . $this->id . '">';
        if ($show_popular_posts || $show_featured_posts || $show_recent_posts || $show_recent_comments || $show_tags) {
            // Navigation
            echo '<nav class="tabs-widget-navigation clearfix">';
            echo '<ul class="ac-tabs-init">';
            if ($show_popular_posts) {
                echo '<li class="current"><a href="#' . $this->id . '_tab-1" title="' . __('Popular Posts', 'acosmin') . '"><i class="fa fa-list-ol"></i></a></li>';
            }
            if ($show_featured_posts) {
                echo '<li><a href="#' . $this->id . '_tab-2" title="' . __('Featured Posts', 'acosmin') . '"><i class="fa fa-star"></i></a></li>';
            }
            if ($show_recent_posts) {
                echo '<li><a href="#' . $this->id . '_tab-3" title="' . __('Latest Posts', 'acosmin') . '"><i class="fa fa-bell"></i></a></li>';
            }
            if ($show_recent_comments) {
                echo '<li><a href="#' . $this->id . '_tab-4" title="' . __('Recent Comments', 'acosmin') . '"><i class="fa fa-comments"></i></a></li>';
            }
            if ($show_tags) {
                echo '<li><a href="#' . $this->id . '_tab-5" title="' . __('Tag Cloud', 'acosmin') . '"><i class="fa fa-tags"></i></a></li>';
            }
            echo '</ul>';
            echo '</nav>';
            // Tabs & Content
            // -- Popular Posts
            if ($show_popular_posts) {
                ?>
                	<div class="sb-content tabs-widget-tab clearfix" id="<?php 
                echo $this->id;
                ?>
_tab-1">
                    	<?php 
                $args = array('orderby' => 'comment_count', 'posts_per_page' => $popular_posts_number, 'ignore_sticky_posts' => 1);
                $wp_query = new WP_Query();
                $wp_query->query($args);
                $count = 0;
                ?>
                    	<ul class="ac-popular-posts">
                        	<?php 
                if ($wp_query->have_posts()) {
                    while ($wp_query->have_posts()) {
                        $wp_query->the_post();
                        $count++;
                        $mcn = get_comments_number();
                        $ncn = get_comments_number();
                        if ($count == 1) {
                            $max_comments_number = $mcn;
                        }
                        if ($ncn != 0) {
                            $make_percent = number_format(100 * $ncn / $max_comments_number);
                            ?>
                             <li>
                            	<span class="position"><?php 
                            echo $count;
                            ?>
</span>
                                <div class="details">
                        			<span class="category"><?php 
                            ac_output_first_category();
                            ?>
</span>
                                    <?php 
                            the_title('<a href="' . esc_url(get_permalink()) . '" class="title" rel="bookmark">', '</a>');
                            ?>
                            		<div class="the-percentage" style="width: <?php 
                            echo $make_percent;
                            ?>
%"></div>
                            		<a href="<?php 
                            comments_link();
                            ?>
" class="comments-number"><?php 
                            ac_comments_number();
                            ?>
</a>
                        		</div>
                            </li>
                            <?php 
                        }
                    }
                } else {
                    ?>
                            <li><?php 
                    _e('No popular posts available!', 'acosmin');
                    ?>
</li>
                            <?php 
                }
                wp_reset_postdata();
                ?>
                        </ul>
                    </div>
                <?php 
            }
            // .END $show_popular_posts
            // -- Featured Posts
            if ($show_featured_posts) {
                ?>
                	<div class="sb-content tabs-widget-tab clearfix" id="<?php 
                echo $this->id;
                ?>
_tab-2">
                    	<?php 
                $args = array('posts_per_page' => $featured_posts_number, 'meta_key' => 'ac_featured_article', 'meta_value' => 1, 'ignore_sticky_posts' => 1);
                $wp_query = new WP_Query();
                $wp_query->query($args);
                $count = 0;
                ?>
                        <ul class="ac-featured-posts">
                        	<?php 
                if ($wp_query->have_posts()) {
                    while ($wp_query->have_posts()) {
                        $wp_query->the_post();
                        $count++;
                        ?>
                        	<li id="featured-post-<?php 
                        echo $count;
                        ?>
">
                    			<figure class="thumbnail<?php 
                        if (!has_post_thumbnail()) {
                            echo ' no-thumbnail';
                        }
                        ?>
">
                                	<?php 
                        if (has_post_thumbnail()) {
                            the_post_thumbnail('ac-sidebar-featured');
                        } else {
                            echo '<img src="' . get_template_directory_uri() . '/images/no-thumbnail.png" alt="' . __('No Thumbnail', 'acosmin') . '" />';
                        }
                        ?>
                            		<figcaption class="details">
                            			<span class="category"><?php 
                        ac_output_first_category();
                        echo get_post_meta('ac_featured_post');
                        ?>
</span>
                                        <?php 
                        the_title('<a href="' . esc_url(get_permalink()) . '" class="title" rel="bookmark">', '</a>');
                        ?>
                                		<a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        _e('Read More', 'acosmin');
                        ?>
" class="read-more"><?php 
                        ac_icon('ellipsis-h fa-lg');
                        ?>
</a>
                            		</figcaption>
                        		</figure>
                    		</li>
                            <?php 
                    }
                }
                wp_reset_postdata();
                ?>
                        </ul>
                    </div>
                <?php 
            }
            // .END $show_featured_posts
            // -- Recent Posts
            if ($show_recent_posts) {
                ?>
                	<div class="sb-content tabs-widget-tab clearfix" id="<?php 
                echo $this->id;
                ?>
_tab-3">
                    	<?php 
                $args = array('posts_per_page' => $recent_posts_number, 'ignore_sticky_posts' => 1);
                $wp_query = new WP_Query();
                $wp_query->query($args);
                $count = 0;
                ?>
                    	<ul class="ac-recent-posts">
                        	<?php 
                if ($wp_query->have_posts()) {
                    while ($wp_query->have_posts()) {
                        $wp_query->the_post();
                        $count++;
                        ?>
                             <li class="clearfix<?php 
                        if ($hide_recent_thumbs) {
                            echo ' full-width';
                        }
                        ?>
">
                             	<?php 
                        if (!$hide_recent_thumbs) {
                            ?>
                            	<figure class="thumbnail">
                                	<?php 
                            if (has_post_thumbnail()) {
                                the_post_thumbnail('ac-sidebar-small-thumbnail');
                            } else {
                                echo '<img src="' . get_template_directory_uri() . '/images/no-thumbnail.png" alt="' . __('No Thumbnail', 'acosmin') . '" class="no-thumbnail" />';
                            }
                            ?>
                                </figure>
                                <?php 
                        }
                        ?>
                                <div class="details">
                        			<span class="category"><?php 
                        ac_output_first_category();
                        ?>
</span>
                                    <?php 
                        the_title('<a href="' . esc_url(get_permalink()) . '" class="title" rel="bookmark">', '</a>');
                        ?>
                            		<a href="<?php 
                        comments_link();
                        ?>
" class="comments-number"><?php 
                        ac_comments_number();
                        ?>
</a>
                        		</div>
                            </li>
                            <?php 
                    }
                } else {
                    ?>
                            <li><?php 
                    _e('No popular posts available!', 'acosmin');
                    ?>
</li>
                            <?php 
                }
                wp_reset_postdata();
                ?>
                        </ul>
                    </div>
                <?php 
            }
            // .END $show_recent_posts
            // -- Recent Comments
            if ($show_recent_comments) {
                ?>
                	<div class="sb-content tabs-widget-tab clearfix" id="<?php 
                echo $this->id;
                ?>
_tab-4">
                    	<?php 
                $args = array('before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '');
                $instance = array('title' => ' ', 'number' => $recent_comments_number);
                the_widget('WP_Widget_Recent_Comments', $instance, $args);
                ?>
                    </div>
                <?php 
            }
            // .END $show_recent_comments
            // -- Tag Cloud
            if ($show_tags) {
                ?>
                	<div class="sb-content tabs-widget-tab clearfix" id="<?php 
                echo $this->id;
                ?>
_tab-5">
                    	<?php 
                $args = array('before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '');
                $instance = array('title' => ' ', 'filter' => 'tags');
                the_widget('WP_Widget_Tag_Cloud', $instance, $args);
                ?>
                    </div>
                <?php 
            }
            // .END $show_tags
        } else {
            echo '<div class="sb-content">' . __('Please select some settings for this widget - Tabs', 'acosmin') . '</div>';
        }
        echo '</aside><!-- END .sidebox .widget -->';
    }
示例#7
0
?>
    
    <div class="wrap-template-1 clearfix">
    
    <section class="content-wrap with-title" role="main">
    	<?php 
// Categories content wrap inside top action
do_action('ac_action_categories_content_wrap_inside_top');
?>
    
    	<header class="main-page-title">
        	<h1 class="page-title"><?php 
_e('Category Archives:', 'justwrite');
?>
 <?php 
ac_output_first_category('', true) . ac_icon('angle-down');
?>
</h1>
        </header>
    
    	<div class="posts-wrap clearfix">
        
        <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        get_template_part('post-templates/content', 'index');
    }
} else {
    get_template_part('post-templates/content', 'no-articles');
}