0

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?

1 Answer 1

1

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));
                ?>  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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