• i have about 15 pages all with about 5 custom fields each using the same, i want to pull all the custom fields into one page as a quick way to read them along witht he page title they are from, would love to be able to crack this but dont know where to start.

Viewing 3 replies - 1 through 3 (of 3 total)
  • First, set up a custom loop that retrieves all of the pages. Then put this code inside the loop:

    <?php
    the_title();
    $custom_fields = get_post_custom($post->ID);
    echo '<ul>';
    foreach  ( $custom_fields as $meta_key => $meta_values )
        foreach ( $meta_values as $meta_value )
            echo '<li>' . $meta_key . ": " . $meta_value . "</li>";
    echo '</ul>';
    ?>

    Note that this will display the WordPress internal custom keys — such as _edit_last and _edit_lock — along with the user defined custom keys. If that is a problem, you can try filtering them out using the ‘if’ test explained on this page:

    http://codex.wordpress.org/Function_Reference/get_post_custom_keys

    Thread Starter oldbag66

    (@oldbag66)

    thanks but im a little confused how to use it, i did get it working in the loop though, the following is what im trying to achive:

    A page listing all custom fields that exist on other pages

    A single Page with custom fields in right hand panel under the photo:
    http://www.playpenmusic.co.uk/artists/jackie-oates/

    And heres the page i want them to display on, currently ive just re-entered the text to recreate the idea but it means updating the avaibility text twice, also it would be good if the artists title was alos pulled in from the page the custom feild is from..

    http://www.playpenmusic.co.uk/artist-availability/

    Hope that makes sense, not easy to explain!

    thanks

    Thread Starter oldbag66

    (@oldbag66)

    i was imaging some sort of “list pages” tag that also pulls in the listed pages featured image

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘display custom fields from all pages on one page’ is closed to new replies.