Support » Plugins » Meta field content in page listing?

  • Resolved jcdesign

    (@jcdesign)


    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jcdesign

    (@jcdesign)

    Bump… anyone? <:D

    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

    Thread Starter jcdesign

    (@jcdesign)

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Meta field content in page listing?’ is closed to new replies.