function get_latest_posts_for_magazine_megamenu(&$output, $item, $converio_menu_item_options, $depth) { global $post; if ($this->is_magazine_megamenu($converio_menu_item_options, $depth)) { $options = $this->build_latest_posts_query_options($item); $posts_query = new WP_Query($options); if ($this->has_children($item)) { $post_number = 3; } else { $post_number = 4; } $output .= '<li class="menu-item latest-posts-wrapper"><ul class="latest-posts columns'; $output .= esc_attr($post_number); $output .= '">'; if ($posts_query->have_posts()) { while ($posts_query->have_posts()) { $posts_query->the_post(); if (has_post_thumbnail(get_the_ID())) { $output .= '<li>'; $output .= '<a href="'; $output .= esc_url(get_permalink()); $output .= '">'; $output .= get_the_post_thumbnail(get_the_ID(), 'thumbnail-related'); $output .= '</a>'; $this->get_post_title($output); } else { $output .= '<li class="post-without-image">'; $this->get_post_title($output); $output .= '<p class="excerpt">'; $output .= converio_custom_excerpt(30, $post); $output .= '</p>'; } if ($this->should_output_author_info($converio_menu_item_options)) { $output .= '<div class="author-and-category">'; $this->get_author_info($output); $output .= '<br>'; $this->get_post_category($output); $output .= '</div>'; } $output .= '</li>'; } } wp_reset_postdata(); $output .= '</ul></li>'; } }
function related_posts($post) { $cids = wp_get_post_categories($post->ID); $options = array('post_type' => 'post', 'post_status' => 'publish', 'category__in' => $cids); $related = new WP_Query($options); if ($related->have_posts()) { ?> <?php $count_related_posts = 0; $output = ''; ?> <?php while ($related->have_posts()) { $related->the_post(); if ($post->ID == get_the_id()) { continue; } ?> <?php if ($count_related_posts < 3) { ?> <?php if (has_post_thumbnail()) { $output .= '<article class="col col3">'; $output .= '<a href="'; $output .= get_permalink(); $output .= '"><div class="img">'; $output .= get_the_post_thumbnail(get_the_ID(), 'thumbnail-related', array()); $output .= ' </div></a>'; $output .= '<h3><a href="'; $output .= get_permalink(); $output .= '">'; $output .= get_the_title(); $output .= '</a></h3>'; $output .= '</article>'; $count_related_posts += 1; ?> <?php } else { ?> <?php $excerpt = get_the_excerpt(); if ($excerpt != '') { $output .= '<article class="col col3">'; $output .= '<h3><a href="'; $output .= get_permalink(); $output .= '">'; $output .= get_the_title(); $output .= '</a></h3>'; $output .= converio_custom_excerpt(30, $post); $output .= '</article>'; $count_related_posts += 1; } ?> <?php } ?> <?php } ?> <?php } ?> <?php if ($output != '') { ?> <section class="related"> <h2><?php esc_attr_e('Related posts', 'converio'); ?> </h2> <div class="columns"> <?php echo $output; ?> </div> </section> <?php } ?> <?php } wp_reset_postdata(); }
"><?php the_title(); ?> </a></h2> <p class="post-meta"><?php the_time(get_option('date_format')); ?> <span>/</span> <?php esc_attr_e('by', 'converio'); ?> <?php the_author(); ?> </p> <p class="text-about"><?php echo converio_custom_excerpt(30, $post); ?> </p> <?php } ?> <?php /* ShareThis */ include_once ABSPATH . 'wp-admin/includes/plugin.php'; ?> <?php if (is_plugin_active('share-this/sharethis.php')) { ?> <div class="info-post share-this"> <div class="share">