Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How to query posts from single post format on Genesis framework? I want to just show posts from gallery post format only.

I tried this query:

<?php 
$recent = new WP_Query(
    "taxonomy=post-format&field=slug&terms=post_format-link&posts_per_page=‌​5"
); 
while($recent->have_posts()) : 
$recent->the_post();
?>

But I didn’t get what I wanted.

share|improve this question
    
Isn't there a Genesis support forum? –  Chris_O Jun 30 '12 at 20:22
    
no replies there :( –  iniyan Jul 1 '12 at 2:14

1 Answer 1

up vote 0 down vote accepted

The taxonomy should be post_format and term should be post-format-link. Also simple taxonomy queries are deprecated since 3.1 in favor of tax_query:

$args = array(
    'posts_per_page' => 5,
    'tax_query' => array(
        array(
            'taxonomy' => 'post_format',
            'field' => 'slug',
            'terms' => 'post-format-link'
        )
    )
);
$recent = new WP_Query( $args ); 
share|improve this answer
    
I did that. mistyped here :( –  iniyan Jul 1 '12 at 2:13
    
your query is still wrong, use the code I've posted here. old query string style taxonomy arguments are taxonomy and term (not plural), and slug is not a valid argument. you should be using tax_query instead anyway. –  Milo Jul 1 '12 at 2:27
    
Thanks. I fixed with your help –  iniyan Jul 1 '12 at 16:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.