/** * publication shortcode * * Options: Show all publication / by Category * */ function wpsp_publication_shortcode($atts, $content = null) { ob_start(); extract(shortcode_atts(array('term_id' => null, 'post_count' => null, 'cols' => null), $atts)); $paged = get_query_var('paged') ? get_query_var('paged') : 1; $args = array(); if ($term_id != '-1') { $args = array('tax_query' => array(array('taxonomy' => 'publications_category', 'field' => 'id', 'terms' => array($term_id)))); } $defaults = array('post_type' => 'publications', 'posts_per_page' => $post_count, 'paged' => $paged); $args = wp_parse_args($args, $defaults); extract($args); $publication_query = new WP_Query($args); if ($publication_query->have_posts()) { ?> <div class="wpsp-row clearfix"> <?php while ($publication_query->have_posts()) { $publication_query->the_post(); ?> <?php $entry_classes = array('entry-publication-article'); $entry_classes[] = 'col'; $entry_classes[] = wpsp_grid_class($cols); ?> <article id="post-<?php the_ID(); ?> " <?php post_class($entry_classes); ?> > <?php get_template_part('template-parts/publication/publication-entry-media'); ?> <?php get_template_part('template-parts/publication/publication-entry-title'); ?> <?php get_template_part('template-parts/publication/publication-entry-meta'); ?> </article><!-- #post-## --> <?php } wp_reset_postdata(); ?> </div> <!-- .wpsp-row .clearfix --> <?php // Pagination if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { wpsp_paging_nav($publication_query->max_num_pages); } ?> <?php } else { echo esc_html__('Sorry, new content will coming soon.', 'learninginstitute'); } return ob_get_clean(); }
/** * List all tour by term * @since Discover Travel 1.0.0 */ function wpsp_get_tour_by_term($args, $cols) { switch ($cols) { case '2': $cols = 'col-sm-6'; break; case '3': $cols = 'col-sm-4'; break; case '4': $cols = 'col-sm-3'; break; } $paged = get_query_var('paged') ? get_query_var('paged') : 1; $defaults = array('post_type' => 'cp_tour', 'orderby' => 'rand', 'posts_per_page' => -1, 'paged' => $paged); $args = wp_parse_args($args, $defaults); extract($args); $custom_query = new WP_Query($args); if ($custom_query->have_posts()) { echo '<div class="row">'; while ($custom_query->have_posts()) { $custom_query->the_post(); echo '<div class="' . $cols . '">'; get_template_part('partials/tour-grid'); echo '</div>'; } wp_reset_postdata(); echo '</div>'; // Pagination if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { echo wpsp_paging_nav($custom_query->max_num_pages); } } else { echo '<h5>' . esc_html__('Sorry, Our tours are not available now!', 'discovertravel') . '</h5>'; } }
?> <div class="portfolio-list-wrap wpsp-row clearfix"> <?php while ($custom_query->have_posts()) { $custom_query->the_post(); ?> <?php get_template_part('template-parts/portfolio/portfolio-entry-layout'); ?> <?php } wp_reset_postdata(); // Pagination if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { wpsp_paging_nav(); } ?> </div> <!-- .wpsp-row .clearfix --> <?php } else { echo esc_html__('Sorry, new content will coming soon.', 'learninginstitute'); } ?> </main><!-- #main --> </div><!-- #primary --> <?php get_sidebar(); get_footer();
</div> <!-- .entry-blog-content --> <?php get_template_part('template-parts/blog/blog-entry-excerpt'); ?> </div> <!-- .entry-post-content-wrap --> </article> <?php } wp_reset_postdata(); ?> </div> <!-- .video-posts .wpsp-row .clearfix --> <?php // Pagination if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { wpsp_paging_nav($video_query->max_num_pages); } ?> <?php } ?> </main><!-- #main --> </div><!-- #primary --> <?php get_sidebar(); get_footer();