List pages including both parent and child pages

I don’t think there is a way to express that precisely in its arguments. You could work around that by building array of page IDs which includes parent and children set as desired. $pages = get_posts( [ ‘post_parent’ => $page_id, ‘post_type’ => ‘page’, ‘fields’ => ‘ids’, ] ); $pages[] = $page_id; wp_list_pages( [ ‘include’ => … Read more

Highlight Single Page Ancestor

So, I never did figure out how to do this without the plugin I mentioned. What fixed the issue was installing: wordpress.org/plugins/custom-post-type-parents. This plugin has a Settings page which allows you to choose the page that is the parent for your custom post type, then it adds the classes necessary to the wp_list_pages menu.

Listing Child Pages in Random order

The sort_column parameter of wp_list_pages() does allow items to be returned in random order using the rand option. sort_column (string) Comma-separated list of column names to sort the pages by. Accepts ‘post_author’, ‘post_date’, ‘post_title’, ‘post_name’, ‘post_modified’, ‘post_modified_gmt’, ‘menu_order’, ‘post_parent’, ‘ID’, ‘rand’, or ‘comment_count’. Default ‘post_title’. add_shortcode( ‘wpb_childpages’, ‘wpb_list_child_pages’ ); function wpb_list_child_pages() { global $post; if … Read more

Renaming wp_list_pages class

Working solution: /* Call using: [top_main_menu] */ add_shortcode( ‘top_main_menu’, ‘echo_top_main_menu’ ); function echo_top_main_menu() { $lookfor = array(‘page_item’); $replacewith = array(‘uk-hidden-small’); $args = array( ‘exclude’ => ‘134,115,104’, ‘echo’ => 0, ‘sort_column’ => ‘menu_order’, ‘title_li’ => __(”) ); $output = wp_list_pages( $args ); echo str_replace($lookfor,$replacewith,$output); }

Remove and change pages label

To change Number of items per page in Screen Options, add this code to functions.php of your theme: function wpse_modify_screen_option() { $number_of_items = 10; // change this to desired value $screen = get_current_screen(); if ( $screen->id != ‘edit-page’ ) return; $user_id = get_current_user_id(); if ( $user_id ) { update_user_meta( $user_id, ‘edit_page_per_page’, $number_of_items ); } } … Read more

Create a list of pages excluding children of selected page

//Create an array containing the IDs of pages that are children of page ID XXX $args = array( ‘post_type’ => ‘page’, ‘post_parent’ => XXX, ‘fields’ => ‘ids’, ‘posts_per_page’ => -1, ); $qry = new WP_Query($args); //Convert the array into a string $string = implode(‘, ‘, $qry->posts); //Display the list of IDs – for testing purposes. … Read more

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