add slug of child(ren) to li using wp_list_pages

OK, I almost got it now… I extended the Walker_Page Class: class Walker_Child_Classes extends Walker_page { function start_el(&$output, $page, $depth, $args, $current_page) { if ( $depth ) $indent = str_repeat(“\t”, $depth); else $indent=””; extract($args, EXTR_SKIP); $output .= $indent . ‘<li class=”‘ . apply_filters( ‘the_title’, $page->post_name, $page->ID ) . ‘”><a href=”‘ . get_page_link($page->ID) . ‘” title=”‘ … Read more

Targeting specific instane of wp_list_pages

Simply add the filter before the call and remove it afterward something like this <ul id=”headerlinks”> <?php add_filter(‘wp_list_pages’, ‘add_markup_pages’); wp_list_pages(‘title_li=&include=24,26,28,30’); remove_filter(‘wp_list_pages’, ‘add_markup_pages’); ?> </ul>

How to apply the ‘current_page_item’ class to an archive page in `wp_list_pages()`?

You can use the following filter: add_filter(‘wp_list_pages’, ‘foo_bar’); function foo_bar($html){ //Create a regex pattern to identify the LI element with preg_match //Create another pattern to identify the class attr and alter it with preg_replace return $html; } As I’m not familiar with the exact elements you are working with, I can’t write up a regex … Read more

wp_list_pages bug in “number” parameter

You can hook into the edit_posts_per_page filter that fires in WP_List_pages right before the pagination is determined. add_action( ‘edit_posts_per_page, ‘limit_list_pages’ ); function limit_list_pages() { $post_type=”post”; $edit_per_page=”edit_” . $post_type . ‘_per_page’; $per_page=(int)get_user_option( $edit_per_page ); if ( empty( $per_page ) || $per_page < 1 ) $per_page=10; //<— Change this to your new per page number return $per_page; … Read more

Check if page has subpages

You have to pass the parent page id to the wp_list_pages function instead of the global $post->ID in your subpages. function wpse33151_getSubpages() { global $post; $parents = get_post_ancestors($post->post_id); krsort($parents); $parents = array_merge(array(), $parents); if (is_home() || is_single()) { $id = get_option(‘page_for_posts’); $parent = get_post_ancestors($id); $id = $parent[0]; } elseif($parents) { $id = $parents[0]; } else … Read more

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