23 Responses

  1. Thomas From
    Thomas From at |

    This is just great – love it!

  2. Benjamin
    Benjamin at |

    I have been looking for this function for 1 week and finaly found it here. Thanks a lot 😉

  3. Tom Sawyer
    Tom Sawyer at |

    If I’m trying to add a page description and keywords to a page to improve the site, is this what I should do?

  4. Jacob
    Jacob at |

    This is perfect. Thank you very much.

  5. Tommie Hansen
    Tommie Hansen at |

    Good work, i hope someone makes this into a plugin though. 🙂

  6. Adam
    Adam at |

    Hi,
    Nice hack, would it be possible to customise this in such a way to get the description to output as you have indicated but to output like this ..

    Page Linkdescrition
    … and so on

    Thanks

  7. Adam
    Adam at |

    Sorted..
    Just changed
    $output .= “” .$description. “”;

  8. Wordpress - Kurzbeschreibung einer Seite via custim Fields ausgeben | Beim Arbeiten

    […] http://tech.shantanugoel.com/2008/03/19/hack-wordpress-function-wplistpages-to-output-page-descripti… Tags:benutzerdefinierte Felder, custom-fields, description, Hacks, WordPress, wp_list_pages […]

  9. David Terranova
    David Terranova at |

    great stuff.

    I just modified it a bit, so that you can control which meta var to pull in, directly from your post/page.

    instead of passing a boolean to start_el to tell it whether to look for “description”, you can simply pass it the name of the meta var:
    update_option(‘get_meta’, “Location”);

    Then in the start_el you could do something like this:
    $get_meta = get_option(“get_meta”);
    if($get_meta!=””){
    $meta_var = get_post_meta($page->ID, “$get_meta”, true);
    if ($page->ID != $current_page){
    $output .= ” “;
    if (!$meta_var){
    $meta_var = strip_tags(substr($page->post_content, 0, 250));
    }
    $output .= $meta_var;
    }
    }

    it’s all I need at the moment (more than 1 set of meta vars) but this could be extended to accept an array of elements… Then it would be ready to be made into a plugin! 🙂

  10. Jim Sefton
    Jim Sefton at |

    Hi,

    Can I use the field I grab from META to sort the pages? In my case the meta tag is price and I would like to sort my pages by the price.

    Thanks

  11. Nurfsoods
    Nurfsoods at |

    Для Вас сайт музыкальных альбомов,музыкальные сайты ucoz,шаблон +ради музыкального сайта,радио хит.

  12. Shane
    Shane at |

    Hi, just exactly what i was looking for. this works great. The only thing i have changed so far is amend the output with span’s with a class name for full CSS control. Could anyone please provide me with an example of how i can extend this in case i wanted to have more than one description ? some kind of loop ? my PHP is not very good 🙁

    any help would be great.

  13. Jon Kristian » Menu Subtitles
    Jon Kristian » Menu Subtitles at |

    […] to wp_list_pages and found a couple of posts on how to achieve this. In the first post I found by Shantanu one had to hack classes.php, a WordPress core file, and the second one by Theme Shaper was lacking […]

  14. Jon Kristian
    Jon Kristian at |
  15. Graveto
    Graveto at |

    Hi,

    first of all I want to say this is a very usefull thing to know. Thank you!
    But…I’ve got a problem with the hack because I want to use it in my header.php to generate a dropdown-navigation which includes small discriptions.
    Everything works fine. The discription appears where it should.
    They are the smaller words are under the main menue points:

    http://annettes.alfahosting.org/MLI/

    But when I visit a subpage the discription disappears.

    Why does this happen?
    Has anyone a idea to solve this?

    Thank you…

  16. Manuel
    Manuel at |

    Hey! thank you very much!

  17. Daniel
    Daniel at |

    Hi,
    Could you help me pls. with displaying list of pages with at least 3-5 custom fields ? I’m almost for 14 days searching on internet, I have only found this article, but there is only one custom field:
    http://www.wprecipes.com/how-to-use-a-custom-blurb-when-listing-pages
    , I asked him for the help to add more fields but no answer .
    Is it hard to modify it, to add other fields , to implement it with your code?
    I have changed my wp-pages into girl’s portfolios so i need list of girls with the girl’s names(page title), country,province,city,age and one thumbnail image(custom field.
    Thanks a lot Daniel

  18. Dinesh
    Dinesh at |

    It’s not recommended to edit WP core files. If you wish to distribute your WP theme you have to attach the core files saying “hay guys, goto your WP installation folder and replace core WP files with this in oder to get the theme working”. If that poor guy was using an update version of WP then your file will replace it and 🙁 🙁 who knows what will happen.

  19. datshay
    datshay at |

    I am using the lates wp version and cant find the file u specified… Can u tell me where is that function defined in new version. I really need this….

Comments are closed.