?> <div class="post-thumb"> <a href="<?php the_permalink(); ?> "><?php the_post_thumbnail('ib-educator-grid'); ?> </a> </div> <?php } ?> <div class="post-body"> <?php the_title('<h2 class="entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h2>'); ?> <div class="post-excerpt"><?php the_excerpt(); ?> </div> </div> <footer class="post-meta"> <?php echo educator_share('menu'); ?> </footer> </article>
<?php get_header(); ?> <section class="section-content"> <div class="container clearfix"> <div class="main-content"> <?php while (have_posts()) { the_post(); IB_Educator_View::template_part('content', 'single-course'); get_template_part('lecturer-bio'); echo educator_share(); echo educator_related_courses(get_the_ID()); } ?> </div> <?php get_sidebar(); ?> </div> </section> <?php get_footer();
function educator_posts_shortcode($atts, $content = null) { $atts = shortcode_atts(array('ids' => '', 'number' => 6, 'categories' => null), $atts); $params = array('post_type' => 'post', 'posts_per_page' => intval($atts['number'])); // Get posts by IDs. if ($atts['ids']) { $ids = explode(' ', $atts['ids']); $params['post__in'] = array(); foreach ($ids as $id) { if (is_numeric($id)) { $params['post__in'][] = $id; } } $params['posts_per_page'] = -1; $params['orderby'] = 'post__in'; $params['ignore_sticky_posts'] = true; } // Categories. if ($atts['categories']) { $categories = explode(' ', $atts['categories']); foreach ($categories as $key => $term_id) { $categories[$key] = intval($term_id); } $params['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'term_id', 'terms' => $categories)); } $query = new WP_Query($params); $output = ''; if ($query->have_posts()) { $output .= '<div class="posts-carousel owl-carousel">'; while ($query->have_posts()) { $query->the_post(); $post_id = get_the_ID(); $output .= '<article class="post-grid">'; if (has_post_thumbnail()) { $output .= '<div class="post-thumb"><a href="' . esc_url(get_permalink()) . '">' . get_the_post_thumbnail($post_id, 'ib-educator-grid') . '</a></div>'; } $output .= '<div class="post-body">'; $output .= '<h2 class="entry-title"><a href="' . esc_url(get_permalink()) . '">' . the_title('', '', false) . '</a></h2>'; ob_start(); the_excerpt(); $output .= '<div class="post-excerpt">' . ob_get_clean() . '</div>'; $output .= '</div>'; if (function_exists('educator_post_meta')) { $output .= '<footer class="post-meta">' . educator_post_meta(array('date', 'comments')) . educator_share('menu') . '</footer>'; } $output .= '</article>'; } wp_reset_postdata(); $output .= '</div>'; } return $output; }