$the_query = new WP_Query($args); // The Loop ?> <?php if ($the_query->have_posts()) { ?> <div class="object-container"> <?php while ($the_query->have_posts()) { $the_query->the_post(); ?> <div class="slider_search_element"> <?php get_object_box(get_the_ID()); ?> </div> <?php } ?> </div> <?php } ?> <?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
<?php $postid = get_the_ID(); if (get_post_type($postid) == 'objeto' || get_post_type($postid) == 'serie' || get_post_type($postid) == 'participante') { ?> <section class="entry-summary"> <div class="object-container"> <?php get_object_box($postid); ?> </div> <?php if (is_search()) { ?> <div class="entry-links"><?php wp_link_pages(); ?> </div><?php } ?> </section> <?php }
function get_recomendedbyobject($objectid, $elements = 5) { $tags = wp_get_post_terms($objectid, 'category'); if ($tags) { $first_tag = $tags[0]->term_id; $args = array('post_type' => array('objeto', 'serie'), 'category__in' => array($first_tag), 'post__not_in' => array($objectid), 'posts_per_page' => $elements, 'caller_get_posts' => 1); $my_query = new WP_Query($args); if ($my_query->have_posts()) { while ($my_query->have_posts()) { $my_query->the_post(); get_object_box(get_the_ID()); ?> <?php } } wp_reset_query(); } }