WordPress.org

Forums

[resolved] Meta field content in page listing? (4 posts)

  1. jcdesign
    Member
    Posted 10 years ago #

    Hi there,

    I'm trying to develop a replacement function for wp_list_pages which can pull in meta field content, and I just can't figure it out. Okay, admittedly I'm probably in over my head, but that's what's so fun about PHP, right?

    The existing code I'd like to be able to swap out is this:
    $page_tree[$page->ID]['title'] = $page->post_title;
    $page_tree[$page->ID]['name'] = $page->post_name;

    I'm trying to get something like this in here using the get_post_meta function:
    $page_tree[$page->ID]['title'] = get_post_meta($postdata->ID, 'other-title', true);
    But I'm getting a blank value there.

    Anyone had any luck with something like this?

    Thanks,
    Jeremy

  2. jcdesign
    Member
    Posted 9 years ago #

    Bump... anyone? <:D

  3. 3stripe
    Member
    Posted 9 years ago #

    Jeremy, can't help you with his myself, but there is a snippet of code at http://wordpress.org/support/topic/39478#post-222573 from Kafkaesqui which you might be able to tweak to suit your needs...

    Good luck ;-)

    3stripe

  4. jcdesign
    Member
    Posted 9 years ago #

    Well, I ended up being able to do it.

    But it involved building a replacement function not only for wp_list_pages() but also for _page_level_out() and get_page_link(). Hairy.

    If you find yourself reading this and you're desperate for help, I could probably send you code for review, but it's specific to my application and I'm not really in a position to offer too much support. I may release it as part of a bilingual plugin at some point, but there are enough problems with it that it may not really be suitable for general release.

Topic Closed

This topic has been closed to new replies.

About this Topic