In my theme, I have a custom post type called sliders. Here the user is allowed to upload images in a meta-box
. So, the images are saved as meta data in wp_post_meta
table.
Now what I want to do is, displaying a slider using its ID.
I did like following but no result
$my_query = new WP_Query('post_type=sliders&p=411');
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
the_post();
endwhile;
}
This doesn't display anything. No even errors. Anyway, If I used the_title()
instead of the_post()
, it shows the title of the slider fine. Same for the the_author()
It shows the author without error.
Why is this weird ?