No longer working with custom post type
-
I use a custom loop in my template for custom post types and a different loop for standard blog posts. Unfortunately, and I’m not sure since which version of WordPress, but the custom post loop no longer works. It never finds any related posts even though there’s a lot with the same tag and category.
Any ideas? Here’s the code I’m using…
<?php $scores = the_related_get_scores(); // pass the post ID if outside of the loop $posts = array_slice( array_keys( $scores ), 0, 10 ); // keep only the the ten best results $args = array( 'post_type' => 'portfolio', 'post__in' => $posts, 'posts_per_page' => 4, 'caller_get_posts' => 1 // ignore sticky status ); $my_query = new WP_Query( $args ); if ( $my_query->have_posts() ) { while ( $my_query->have_posts() ) { $my_query->the_post(); echo '<li class="g_3 block">'; echo '<a href="' . get_permalink( get_the_ID() ) . '">'; the_post_thumbnail('portfolio-thumb'); echo '<h3>'; the_title(); echo '</h3>'; echo '</a>'; echo '</li>'; } } else { echo "No posts found..."; } ?>
- The topic ‘No longer working with custom post type’ is closed to new replies.