Better customization for WP List Pages
This is something that has driven me crazy about WordPress for ages. WP List Pages is pretty inflexible for HTML. So if I want to add descriptions to my WP list pages, for example, I have to actually go intp wordpress core, and since I don’t want to edit WordPress core, I copy wp_list_pages and several filters and classes and other PHP. When there’s really basically one thing I want to change — the start and end variables for the elements and levels. I also did one modification where I wanted to use different start/end level HTML for level 0 (depth=1) and for any other levels.
This means that I need to update this code pretty often and then redo all of my custom references to new functions because wp_list_pages does get updated. IMO this is a pretty reasonable thing to wish to edit, and it would be great to have something like the shortcodes API to use to make custom html for WP list pages — I guess in an additional arg added to wp_list_pages and then maybe add it via apply_filters or something. This way one could make several additional HTML options for wp_list_pages for different specific uses.
Oh, by the way, my use case for WP List Pages as opposed to get_posts or something (which I could customize completely) is the tree-walking goodness done by WP_List_pages. If this is easier than I think it is let me know but it seems alarming to me to write a php function based on get_posts that could go down a very large number of levels. I don’t want to have to worry about running out of levels if down the line the site needs 6 and I only wrote the menu with 5. And WP List Pages keeps track of level number already and where it is in the tree.
I hope no one has posted this question. I took a look at the tags and didn’t see anything.
- The topic ‘Better customization for WP List Pages’ is closed to new replies.