function road_latestposts_shortcode($atts)
{
    global $road_opt;
    $post_index = 0;
    $atts = shortcode_atts(array('posts_per_page' => 5, 'order' => 'DESC', 'orderby' => 'post_date', 'image' => 'wide', 'length' => 20, 'rowsnumber' => '1', 'colsnumber' => '4'), $atts, 'latestposts');
    if ($atts['image'] == 'wide') {
        $imagesize = 'sozo-post-thumbwide';
    } else {
        $imagesize = 'sozo-post-thumb';
    }
    $html = '';
    $postargs = array('posts_per_page' => $atts['posts_per_page'], 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => $atts['orderby'], 'order' => $atts['order'], 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_mime_type' => '', 'post_parent' => '', 'post_status' => 'publish', 'suppress_filters' => true);
    $postslist = get_posts($postargs);
    $html .= '<div class="posts-carousel" data-col="' . $atts['colsnumber'] . '">';
    foreach ($postslist as $post) {
        $post_index++;
        if (0 == ($post_index - 1) % $atts['rowsnumber'] || $post_index == 1) {
            $html .= '<div class="group">';
        }
        $html .= '<div class="item-col">';
        $html .= '<div class="post-wrapper">';
        $html .= '<div class="post-thumb">';
        $html .= '<a href="' . get_the_permalink($post->ID) . '">' . get_the_post_thumbnail($post->ID, $imagesize) . '</a>';
        $html .= '</div>';
        $html .= '<div class="post-info">';
        $html .= '<h3 class="post-title"><a href="' . get_the_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></h3>';
        $html .= '<span class="post-date"><span class="day">' . get_the_date('d', $post->ID) . '</span><span class="month">' . get_the_date('M', $post->ID) . '</span></span>';
        $html .= '<div class="post-excerpt">';
        $html .= RoadThemes::road_excerpt_by_id($post, $length = $atts['length']);
        $html .= '</div>';
        $html .= '</div>';
        $html .= '</div>';
        $html .= '</div>';
        if (0 == $post_index % $atts['rowsnumber'] || $atts['posts_per_page'] == $post_index) {
            $html .= '</div>';
        }
    }
    $html .= '</div>';
    wp_reset_postdata();
    return $html;
}
Exemple #2
0
						<?php 
    /* Start the Loop */
    while (have_posts()) {
        the_post();
        /* Include the post format-specific template for the content. If you want to
         * this in a child theme then include a file called called content-___.php
         * (where ___ is the post format) and that will be used instead.
         */
        get_template_part('content', get_post_format());
    }
    ?>
						
						<div class="pagination">
							<?php 
    RoadThemes::road_pagination();
    ?>
						</div>
						
					<?php 
} else {
    ?>
						<?php 
    get_template_part('content', 'none');
    ?>
					<?php 
}
?>
				</div>
			</div>
			<?php 
Exemple #3
0
/**
 * Template Name: Full Width
 *
 * Description: Full Width page template
 *
 * @package WordPress
 * @subpackage Road_Themes
 * @since Road Themes 1.0
 */
global $road_opt;
get_header();
?>
<div class="main-container full-width">
	<div class="container">
		<?php 
RoadThemes::road_breadcrumb();
?>
	</div>
	<header class="entry-header">
		<div class="container">
			<h1 class="entry-title"><?php 
the_title();
?>
</h1>
		</div>
	</header>
	
	<div class="page-content">
		<div class="container">
			<?php 
while (have_posts()) {
    ?>
				<div class="entry-summary">
					<?php 
    the_excerpt();
    ?>
				</div>
			<?php 
}
?>
			
			<?php 
if (is_single()) {
    ?>
				<div class="entry-meta">
					<?php 
    RoadThemes::road_entry_meta();
    ?>
				</div>
			
				<?php 
    if (function_exists('road_blog_sharing')) {
        ?>
					<div class="social-sharing"><?php 
        road_blog_sharing();
        ?>
</div>
				<?php 
    }
    ?>
			
				<div class="author-info">
    public function widget($args, $instance)
    {
        global $post, $road_opt;
        $title = apply_filters('widget_title', $instance['title']);
        // before and after widget arguments are defined by themes
        echo wp_kses($args['before_widget'], array('aside' => array('id' => array(), 'class' => array())));
        if (!empty($title)) {
            echo wp_kses($args['before_title'] . $title . $args['after_title'], array('aside' => array('id' => array(), 'class' => array()), 'h3' => array('class' => array()), 'span' => array('class' => array())));
        }
        switch ($instance['type']) {
            case 'recent_posts':
                $postargs = array('posts_per_page' => $instance['amount'], 'order' => 'DESC', 'orderby' => 'post_date');
                $postslist = get_posts($postargs);
                ?>
				<div class="recent-posts">
					<ul>
						<?php 
                foreach ($postslist as $post) {
                    setup_postdata($post);
                    ?>
 
							<li>
								<div class="post-wrapper">
									<div class="post-thumb">
										<a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_post_thumbnail(array(50, 50));
                    ?>
</a>
									</div>
									<div class="post-info">
										<h3 class="post-title"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h3>
										<div class="post-date">
											<?php 
                    echo get_the_date();
                    ?>
										</div>
									</div>
								</div>
							</li>
						<?php 
                }
                ?>
					</ul>
				</div>
				<?php 
                wp_reset_postdata();
                break;
            case 'popular_posts':
                $postargs = array('posts_per_page' => $instance['amount'], 'order' => 'DESC', 'orderby' => 'comment_count');
                $postslist = get_posts($postargs);
                ?>
				<div class="recent-posts">
					<ul>
						<?php 
                foreach ($postslist as $post) {
                    setup_postdata($post);
                    ?>
 
							<li>
								<div class="post-wrapper">
									<div class="post-thumb">
										<a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_post_thumbnail(array(50, 50));
                    ?>
</a>
									</div>
									<div class="post-info">
										<h3 class="post-title"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h3>
										<div class="post-date">
											<?php 
                    echo get_the_date();
                    ?>
										</div>
									</div>
								</div>
							</li>
						<?php 
                }
                ?>
					</ul>
				</div>
				<?php 
                wp_reset_postdata();
                break;
            case 'recent_comments':
                $commentargs = array('status' => 'approve', 'post_type' => 'post', 'number' => $instance['amount']);
                $comments = get_comments($commentargs);
                ?>
				<ul>
					<?php 
                foreach ($comments as $comment) {
                    ?>
					<li>
						<div class="post-wrapper">
							<div class="post-thumb">
								<?php 
                    echo get_avatar($comment->comment_author_email, 50, '', '');
                    ?>
							</div>
							<div class="post-info">
								<p><?php 
                    echo esc_html($comment->comment_author);
                    ?>
 <?php 
                    esc_html_e('says', 'roadthemes');
                    ?>
:</p>
								<a href="<?php 
                    echo get_comments_link($comment->comment_post_ID);
                    ?>
" title="<?php 
                    echo esc_attr($comment->comment_author) . ' on ' . get_the_title($comment->comment_post_ID);
                    ?>
"><?php 
                    echo RoadThemes::roadlimitStringByWord($comment->comment_content, 30, '...');
                    ?>
</a>
							</div>
						</div>
					</li>
					<?php 
                }
                ?>
				</ul>	
				<?php 
                break;
        }
        echo wp_kses($args['after_widget'], array('aside' => array('id' => array(), 'class' => array()), 'h3' => array('class' => array()), 'span' => array('class' => array())));
    }