Forums

[resolved] Returning pages with a specific Custom Field (5 posts)

  1. mitchrenton
    Member
    Posted 2 years ago #

    Hi Guys,

    Just wondering if anybody can help me here. I want to create a loop that returns all pages with a specific custom field. Can this be done? I have no problem returning pages with specific custom fields but having trouble returning pages.

    Has anybody achieved this?

  2. mitchrenton
    Member
    Posted 2 years ago #

    Oops just realised a typo, should have read...

    Hi Guys,

    Just wondering if anybody can help me here. I want to create a loop that returns all pages with a specific custom field. Can this be done? I have no problem returning *posts* with specific custom fields but having trouble returning pages.

    Has anybody achieved this?

  3. songdogtech
    Member
    Posted 2 years ago #

    Custom Fields explains and gives examples

  4. mitchrenton
    Member
    Posted 2 years ago #

    I've managed to solve this one, incase anybody else runs into it...

    You have to tell the loop that you want to look at pages and not posts by using the following...

    <?php query_posts(array('post_type' => 'page'); ?>

  5. Mark / t31os
    Moderator
    Posted 2 years ago #

    You don't necessarily need the array...

    Just..

    <?php query_posts('post_type=page'); ?>

    ..should be fine..

    :)

Topic Closed

This topic has been closed to new replies.

About this Topic