• Resolved mitchrenton

    (@mitchrenton)


    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?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mitchrenton

    (@mitchrenton)

    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?

    Custom Fields explains and gives examples

    Thread Starter mitchrenton

    (@mitchrenton)

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

    You don’t necessarily need the array…

    Just..

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

    ..should be fine..

    ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Returning pages with a specific Custom Field’ is closed to new replies.