List all-childpages on parent-page AND list child-pages on childpage itself but not the current one?

function show_subpages() { global $post; $subpages = wp_list_pages( array( ‘echo’ =>0, ‘title_li’ =>”, ‘depth’ =>2, ‘link_before’ => ‘&mdash; ‘, ‘child_of’ => ( $post->post_parent == 0 ? $post->ID : $post->post_parent), ‘exclude’ => ( $post->post_parent == 0 ? ” : $post->ID) )); if ( !empty($subpages) ) { echo ‘<ul id=”subpages” class=”wrapper”>’; echo $subpages; echo ‘</ul>’; } } … Read more

List all Posts under heading in wp_list_pages menu

You’ve got the right idea, however; Don’t use query_posts, use get_posts instead Using the wp_list_pages filter will just add the list at the end Using template tags like the_permalink() will echo the output, so you can’t use it in string concatenation You’ll need to use a custom walker (the family of classes for generating hierarchical … Read more

Change Parent Name with wp_list_pages?

You could of course use some preg_replace() tricks to solve this, but here’s a little (untested) idea using the the_title filter instead: add_filter( ‘the_title’, ‘wpse_title’ ); $children = wp_list_pages(“title_li=&include=”.$post->post_parent.”&echo=0″); where our filter callback is: function wpse_title( $title ) { remove_filter( current_filter(), __FUNCTION__ ); return __( ‘Overview’ ); } Remark 1: I think you should consider … Read more

Show siblings (if any) and parents

As it stands your code almost works, but it checks to see if the current page has a parent, which will always be true for both 2nd and 3rd level pages. WordPress gives us get_ancestors to retrieve an ordered array of ancestors for any hierarchical object type: get_ancestors( $object_id, $object_type ); So we can use … Read more

How would I add the comment count to this sub-pages of current page snippet

A custom walker can be passed to wp_list_pages() using the $walker parameter. Here is a custom walker named WPSE_Walker_Page_Comment_Count() which is based on the default page walker, Walker_Page(). We’re only overriding the start_el() method in this case. The output has been customized to include the comment count. First, add the walker code to your theme’s … Read more

Highlight another nav item

The page_css_class filter lets you modify the classes each menu item gets. Here we check if we are currently viewing a singular envira post type and the menu item slug is gallery. In that case we add a class to the array of default classes passed to the function. function wpd_page_css_class( $css_class, $page ){ if( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)