/** * post shortcode * * Options: Show all post / by Category * */ function wpsp_post_shortcode($atts, $content = null) { ob_start(); extract(shortcode_atts(array('term_id' => null, 'post_format' => null, 'post_meta' => null, 'post_excerpt' => null, 'post_style' => null, 'post_offset' => null, 'post_count' => null, 'cols' => null), $atts)); //$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array(); if ($post_format != 'post-format-standard') { $args = array('tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array($post_format), 'operator' => 'IN'))); } if ($post_offset != '') { $args = array('offset' => $post_offset); } $defaults = array('post_type' => 'post', 'category__in' => $term_id, 'posts_per_page' => $post_count, 'tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-quote', 'post-format-audio', 'post-format-gallery', 'post-format-image', 'post-format-link', 'post-format-video'), 'operator' => 'NOT IN'))); $args = wp_parse_args($args, $defaults); extract($args); $post_query = new WP_Query($args); if ($post_query->have_posts()) { ?> <div class="wpsp-row clearfix"> <?php while ($post_query->have_posts()) { $post_query->the_post(); ?> <?php // entry-class $entry_classes = array('entry-blog-article'); $entry_classes[] = $post_style; $entry_classes[] = 'col'; $entry_classes[] = wpsp_grid_class($cols); ?> <article id="post-<?php the_ID(); ?> " <?php post_class($entry_classes); ?> > <?php if ('overlay-2' == $post_style) { ?> <div class="post-thumbnail-wrap overlay-2"> <div class="post-thumbnail"><?php wpsp_get_post_thumbnail('thumb-full'); ?> </div> <div class="caption-wrap"> <div class="caption-inner"> <a href="<?php wpsp_permalink(); ?> " title="<?php echo wpsp_esc_title(); ?> " rel="bookmark"><span class="title"><?php the_title(); ?> </span></a> </div> </div> </div> <?php } else { ?> <?php printf('<div class="post-thumbnail"><a itemprop="url" href="%1$s" rel="bookmark" title="%2$s">%3$s</a></div>', wpsp_get_permalink(), wpsp_get_esc_title(), wpsp_post_thumbnail('thumb-full')); ?> <div class="entry-post-content-wrap"> <div class="entry-blog-content"> <?php get_template_part('template-parts/blog/blog-entry-title'); ?> <?php if ($post_meta) { get_template_part('template-parts/blog/blog-entry-meta'); } ?> </div> <?php if ($post_excerpt) { get_template_part('template-parts/blog/blog-entry-excerpt'); } ?> </div> <!-- .entry-post-content-wrap --> <?php } ?> </article><!-- #post-## --> <?php } wp_reset_postdata(); ?> </div> <?php // Pagination /* if(function_exists('wp_pagenavi')) wp_pagenavi(); else wpsp_paging_nav($post_query->max_num_pages); */ ?> <?php } else { echo esc_html__('Sorry, new content will coming soon.', 'learninginstitute'); } return ob_get_clean(); }
function wpsp_staff_column_class($query) { if ('related' == $query) { return wpsp_grid_class(3); } else { return wpsp_grid_class(3); } }
* @link https://codex.wordpress.org/Template_Hierarchy * * @package Learning_Institute */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } if (!isset($related_query)) { global $post_count; } // Add Standard Classes $classes = array(); $classes[] = 'related-post'; $classes[] = 'col'; $classes[] = wpsp_grid_class(3); $classes[] = 'col-' . $post_count; ?> <article id="post-<?php the_ID(); ?> " <?php post_class($classes); ?> > <div class="blog-entry-inner"> <?php printf('<div class="post-thumbnail"><a itemprop="url" href="%1$s" rel="bookmark" title="%2$s">%3$s</a></div>', wpsp_get_permalink(), wpsp_get_esc_title(), wpsp_post_thumbnail('thumb-landscape')); ?> <?php
the_content(); ?> </section> <!-- .about-entry-content --> <section class="featured-pages wpsp-row clearfix"> <?php // setup cols $page_count = 0; $cols = rwmb_meta('wpsp_page_col') ? rwmb_meta('wpsp_page_col') : 4; $post_style = rwmb_meta('wpsp_featured_page_style') ? rwmb_meta('wpsp_featured_page_style') : 'post-highlight-green'; $post_excerpt = 1; $excerpt_length = 25; $entry_classes = rwmb_meta('wpsp_featured_page_style') == 'post-masonry' ? array('page-entry-overlay') : array('entry-blog-article'); $entry_classes[] = $post_style; $entry_classes[] = 'col'; $entry_classes[] = wpsp_grid_class($cols); $args = array('child_of' => rwmb_meta('wpsp_featured_parent_page'), 'sort_column' => 'menu_order'); $featured_pages = get_pages($args); if (!empty($featured_pages)) { foreach ($featured_pages as $page) { $page_count++; $entry_classes[] = 'col-' . $page_count; ?> <?php if (rwmb_meta('wpsp_featured_page_style') == 'post-masonry') { $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id($page->ID), 'large'); if ($page_count == 1) { $image_url = aq_resize($thumb_url[0], '415', '565', true); } else { $image_url = aq_resize($thumb_url[0], '415', '270', true);
$page_count = 0; $args = array('child_of' => $about_meta['wpsp_main_program_page'][0], 'sort_column' => 'menu_order'); $featured_pages = get_pages($args); if (!empty($featured_pages)) { foreach ($featured_pages as $page) { $page_count++; $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id($page->ID), 'large'); if ($page_count == 1) { $image_url = aq_resize($thumb_url[0], '415', '560', true); } else { $image_url = aq_resize($thumb_url[0], '415', '270', true); } if ($page_count <= 3) { $entry_classes = array('page-entry-overlay'); $entry_classes[] = 'col'; $entry_classes[] = wpsp_grid_class(2); $entry_classes[] = 'col-' . $page_count; ?> <article id="post-<?php the_ID(); ?> " <?php post_class($entry_classes); ?> > <div class="entry-page post-thumbnail-wrap overlay-1"> <img src="<?php echo $image_url; ?> "> <div class="caption-wrap">