• Resolved nemci7v

    (@nemci7v)


    Hello again ??

    I’m using a custom meta key that displays posts if the value is on using

    <?php query_posts('meta_key=feature_value&meta_value=on'); ?>

    It displays posts without a problem but nothing appears for pages. Is it possible to query both posts and pages via the meta key?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Is it possible to query both posts and pages via the meta key?

    yes

    Are you sure the logic is in place when the page.php template is being used (when displaying a page)?

    Thread Starter nemci7v

    (@nemci7v)

    Well, it works with posts. I’m using the code in a slideshow. It slides through posts but no pages.

    Thread Starter nemci7v

    (@nemci7v)

    anyone know?

    Set the post_type to any…

    eg.

    <?php query_posts( array( 'meta_key' => 'feature_value', 'meta_value' => 'on', 'post_type' => 'any' ) ); ?>

    or

    <?php query_posts( 'meta_key=feature_value&meta_value=on&post_type=any' ); ?>

    Thread Starter nemci7v

    (@nemci7v)

    thank you so much! I didn’t think the code would be so simple.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Querying pages and posts’ is closed to new replies.