Example #1
0
	</div><!-- End .post-text-wrap -->

	</div><!-- End .blog-post-inner -->

</article><!-- End Post -->

<?php 
    }
    ?>

</section><!-- End #blog-container -->


<!-- Posts Pagination -->
<?php 
    royal_pagination('', 'infinite');
    ?>


<!-- if have no posts -->
<?php 
} else {
    ?>
	<div class="inner-content">
		<h3><?php 
    esc_html_e('No Posts found!', 'hyperx');
    ?>
</h3>
	</div>
<?php 
}
Example #2
0
    function royal_blog_shortcode($atts)
    {
        $parameters = shortcode_atts(array('blog_display_from' => 'all', 'blog_custom_categories' => '', 'blog_custom_ids' => '', 'blog_display_filters' => '', 'blog_display_pagination' => '', 'blog_layout_mode' => 'masonry', 'blog_posts_number' => '10', 'blog_columns_rate' => '0', 'blog_gutter_horz' => '20', 'blog_gutter_vert' => '20', 'blog_stretch_container' => '', 'blog_disable_paddings' => '', 'blog_disable_margins' => ''), $atts);
        extract($parameters);
        // get theme customizer data
        $bPage_general = get_option('royal_bPage_general');
        $bPost_title = get_option('royal_bPost_title');
        $bPost_cats = get_option('royal_bPost_cats');
        $bPost_meta = get_option('royal_bPost_meta');
        $bPost_desc = get_option('royal_bPost_desc');
        $bPost_likes = get_option('royal_bPost_likes');
        $bPost_more = get_option('royal_bPost_more');
        $sidebar = get_option('royal_sidebar');
        $filter_items = get_option('royal_filter_items');
        global $post;
        ?>

		<!-- Blog Filters -->
		<?php 
        if ($blog_display_filters === 'yes' && $blog_display_from !== 'custom_ids') {
            ?>

			<ul class="filters body-section">

				<?php 
            if ($filter_items['isotope'] === true) {
                ?>
				<li>
					<a class="rf-button active-filter-item active-state" data-filter="*">
						<i class="fa fa-<?php 
                echo $filter_items['icon'];
                ?>
"></i>
						<span><?php 
                echo $filter_items['blog_all_text'];
                ?>
</span>
						<i class="fa fa-<?php 
                echo $filter_items['icon'];
                ?>
"></i>
						<sup></sup>
					</a>
				<?php 
            }
            ?>
				
				<?php 
            // Portfolio Filters
            // blog categories
            $blog_cats = get_terms('category');
            // show all blog item filters
            if ($blog_display_from === 'all') {
                // if category array is not empty
                if (count($blog_cats) > 0) {
                    foreach ($blog_cats as $cats => $cat) {
                        $cat_url = $filter_items['isotope'] === true ? '' : 'href="' . get_term_link($cat, 'category') . '"';
                        echo '<li><a ' . $cat_url . ' class="rf-button" data-filter=".' . urldecode($cat->slug) . '"><i class="fa fa-' . $filter_items['icon'] . '"></i>' . $cat->name . '<i class="fa fa-' . $filter_items['icon'] . '"></i><sup></sup></a></li>';
                    }
                }
                // show blog item filters from custom categories
            } elseif ($blog_display_from === 'custom_categories') {
                // get custom categories
                $blog_cats = explode(',', $blog_custom_categories);
                foreach ($blog_cats as $key => $value) {
                    $current_cat_name = get_category_by_slug($value);
                    $cat_url = $filter_items['isotope'] === true ? '' : 'href="' . get_term_link($value, 'category') . '"';
                    echo '<li><a ' . $cat_url . ' class="rf-button" data-filter=".' . urldecode($current_cat_name->slug) . '"><i class="fa fa-' . $filter_items['icon'] . '"></i>' . $current_cat_name->name . '<i class="fa fa-' . $filter_items['icon'] . '"></i><sup></sup></a></li>';
                }
            }
            // endif
            ?>

			</ul>

		<?php 
        }
        ?>


		<?php 
        // Blog Posts Container
        $blog_container_atts = 'data-layout="' . $blog_layout_mode . '" ';
        $blog_container_atts .= 'data-columns-rate="' . $blog_columns_rate . '" ';
        $blog_container_atts .= 'data-gutter-horz="' . $blog_gutter_horz . '" ';
        $blog_container_atts .= 'data-gutter-vert="' . $blog_gutter_vert . '" ';
        $blog_container_atts .= 'data-aspect-width="' . $bPage_general['aspect_x'] . '" ';
        $blog_container_atts .= 'data-aspect-height="' . $bPage_general['aspect_y'] . '" ';
        // container class
        $blog_container_class = '';
        if ($blog_stretch_container === 'yes') {
            $blog_container_class .= 'stretch-container ';
        }
        if ($blog_disable_paddings === 'yes') {
            $blog_container_class .= 'blog-container-no-padding ';
        }
        if ($blog_disable_margins !== 'yes') {
            $blog_container_class .= 'body-section';
        }
        if ($blog_display_from !== 'custom_ids') {
            if (get_query_var('paged')) {
                $paged = get_query_var('paged');
            } else {
                if (get_query_var('page')) {
                    $paged = get_query_var('page');
                } else {
                    $paged = 1;
                }
            }
            // blog categories
            $blog_cats = get_terms('category');
            $blog_custom_categories = explode(',', $blog_custom_categories);
            if (!empty($blog_cats)) {
                foreach ($blog_cats as $key => $value) {
                    $all_cats[] = urldecode($value->slug);
                }
            }
            // categories which will be displayed
            $cats_2_show = $blog_display_from === 'all' ? $all_cats : $blog_custom_categories;
            if (empty($cats_2_show)) {
                $cats_2_show = '';
            }
            $tax_query_args = array('taxonomy' => 'category', 'field' => 'slug', 'terms' => $cats_2_show);
            $blog = new WP_Query(array('post_type' => 'post', 'tax_query' => array($tax_query_args), 'posts_per_page' => $blog_posts_number, 'post__not_in' => array(get_the_ID()), 'paged' => $paged));
        } else {
            $blog_custom_ids = explode(',', $blog_custom_ids);
            $blog = new WP_Query(array('post_type' => 'post', 'post__in' => $blog_custom_ids));
        }
        if ($blog->have_posts()) {
            echo '<section id="blog-container"  class="' . $blog_container_class . '"  ' . $blog_container_atts . ' >';
            // default post width for masonry-metro
            if ($bPage_general['layout'] === 'masonry-metro') {
                echo '<div class="blog-grid-sizer"></div>';
            }
            // index page loop - displays blog posts
            while ($blog->have_posts()) {
                $blog->the_post();
                // get data from custom fields
                $rf_metro_post_width = get_post_meta($post->ID, 'rf_metro_post_width', true);
                // Metro Layout Grid
                $metro_width_class = '';
                // custom post width for masonry-metro
                if ($bPage_general['layout'] === 'masonry-metro') {
                    $metro_width_class = 'post-width' . $rf_metro_post_width;
                }
                $custom_post_class = implode(' ', royal_cat_classes('blog')) . ' ' . $metro_width_class;
                ?>

		<!-- Begin Post -->
		<article <?php 
                post_class($custom_post_class);
                ?>
 id="post-<?php 
                the_ID();
                ?>
">

			<div class="blog-post-inner<?php 
                echo $bPage_general['grid_animated'] ? ' rf-grid-animated' : '';
                ?>
">

			<!-- Post Text Block - Above Media -->
			<div class="post-text-wrap">

				<?php 
                // Post Title
                if ($bPost_title['position'] === 'above') {
                    royal_post_title();
                }
                // Post Categories & Filters
                if ($bPost_cats['position'] === 'above') {
                    royal_post_categories('blog', $bPost_cats['before_cats'], $bPost_cats['separator']);
                }
                // Post Date & Author
                if ($bPost_meta['position'] === 'above') {
                    royal_post_date_and_author('blog', $bPost_meta['before_author']);
                }
                // Post Excerpt / Post Content
                if ($bPost_desc['position'] === 'above') {
                    royal_post_content($bPost_desc['display_as'], $bPost_desc['excerpt_length']);
                }
                // Likes, Sharing & Comments
                if ($bPost_likes['position'] === 'above') {
                    royal_post_likes_comments_sharing(array('likes_icon' => $bPost_likes['likes_icon'], 'comments_icon' => $bPost_likes['comments_icon'], 'separator' => $bPost_likes['icon_separator'], 'sharing_open' => $bPost_likes['open_on']));
                }
                // Read More
                if ($bPost_more['position'] === 'above') {
                    royal_post_more_info(array('type' => 'blog', 'more_text' => $bPost_more['text'], 'more_icon' => $bPost_more['icon']));
                }
                ?>

			</div><!-- End .post-text-wrap -->


			<!-- Post Media Block -->
			<div class="post-media-wrap">

				<div class="post-media">
					
					<!-- include post format media content -->
					<?php 
                get_template_part('post-formats/content', get_post_format());
                ?>

				</div>

			</div><!-- end .post-media-wrap -->


			<!-- Post Text Block - Below Media -->
			<div class="post-text-wrap">

				<!-- Post Title -->
				<?php 
                // Post Title
                if ($bPost_title['position'] === 'below') {
                    royal_post_title();
                }
                // Post Categories & Filters
                if ($bPost_cats['position'] === 'below') {
                    royal_post_categories('blog', $bPost_cats['before_cats'], $bPost_cats['separator']);
                }
                // Post Date & Author
                if ($bPost_meta['position'] === 'below') {
                    royal_post_date_and_author('blog', $bPost_meta['before_author']);
                }
                // Post Excerpt / Post Content
                if ($bPost_desc['position'] === 'below') {
                    royal_post_content($bPost_desc['display_as'], $bPost_desc['excerpt_length']);
                }
                // Likes, Sharing & Comments
                if ($bPost_likes['position'] === 'below') {
                    royal_post_likes_comments_sharing(array('likes_icon' => $bPost_likes['likes_icon'], 'comments_icon' => $bPost_likes['comments_icon'], 'separator' => $bPost_likes['icon_separator'], 'sharing_open' => $bPost_likes['open_on']));
                }
                // Read More
                if ($bPost_more['position'] === 'below') {
                    royal_post_more_info(array('type' => 'blog', 'more_text' => $bPost_more['text'], 'more_icon' => $bPost_more['icon']));
                }
                ?>

			</div><!-- End .post-text-wrap -->

			</div><!-- End .blog-post-inner -->

		</article><!-- End Post -->

		<?php 
            }
            ?>

		</section><!-- End #blog-container -->

		
		<?php 
            // restore original post data
            wp_reset_postdata();
            // posts pagination
            if ($blog_display_pagination === 'yes' && $blog_display_from !== 'custom_ids') {
                royal_pagination($blog->max_num_pages);
            }
            ?>

		<!-- if have no posts -->
		<?php 
        } else {
            ?>
			<div class="inner-content">
				<h3><?php 
            _e('No Posts found!', 'hyperx');
            ?>
</h3>
			</div>
		<?php 
        }
        ?>

	    <?php 
    }
Example #3
0
</article><!-- End Post -->

<?php 
    }
    ?>


</section><!-- End #portfolio-container -->


<?php 
    // restore original post data
    wp_reset_postdata();
    // posts pagination
    royal_pagination($portfolio->max_num_pages, 'infinite');
    ?>


<!-- if have no posts -->
<?php 
} else {
    ?>
	<div class="inner-content">
		<h3><?php 
    esc_html_e('No Portfolio Items found!', 'hyperx');
    ?>
</h3>
	</div>
<?php 
}