Add dynamic meta value to wp_list_pages
-
Hi.
I need a list of all of a page’s child pages with custom meta values beside each title.
I have the function for the child pages working just fine:function wpb_list_child_pages() { global $post; if ( is_page() && $post->post_parent ) $childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&echo=0' ); else $childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=0' ); if ( $childpages ) { $string = '<ul>' . $childpages . '</ul>'; } return $string; }
But I can’t seem to be able to add the meta key to it.
I need the output to be something like:<ul> <li>Child page title <span><?php $key="duration"; echo get_post_meta($post->ID, $key, true); ?></span></li> </ul>
Thoughts?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add dynamic meta value to wp_list_pages’ is closed to new replies.