Getting posts from a specific post_format only
-
Hi all ??
I’ll try and be short (without being rude, I hope): I’m doing some heavy change to a wordpress theme – like uhm, doing it from scratch – and I’m really amazed at the potential of post_formats.
What I’d like to do is getting *only* posts from a specific post_format (ie.: gallery) and add them – ok, just a thumbnail ?? – to my sidebar.
I tried with get_posts, but I have no idea which parameter should I use to get them, so… Documentation seems not to mention post_format, in these cases…
Any Idea?
I tried something like
<?php $args = array( 'numberposts' => 3, 'post_format' => gallery ); $lastposts = get_posts( $args ); foreach($lastposts as $post) : setup_postdata($post); ?> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php endforeach; ?>
Obviously, it doesn’t work ??
I suppose post formats are a special type of post_type, but… which is the “name” of them?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Getting posts from a specific post_format only’ is closed to new replies.