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.

I have a page template and at the bottom, I want a loop of posts based on a custom field value - store_name

This is what I have:

<?php
    global $wp_query;
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts(array('posts_per_page' => '10','paged'=>$paged,'category_name'=>'<?php echo get_post_meta($post->ID, 'store_name', true); ?>'));
                ?>

But of course that doesn't work because I know my syntax is incorrect with the nested php statement, but how do I fix it?

share|improve this question
add comment

1 Answer

Nevermind.

Got it working with:

<?php
                    global $wp_query;

                    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

                    $store_name = (get_post_meta($post->ID, 'store_name', true));

                    query_posts(array('posts_per_page' => '10','paged'=>$paged,'category_name'=>$store_name));
                ?>  
share|improve this answer
add comment

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.