Tag Info

New answers tagged

2

The following filter shows only the top-level custom post type items in page attribute dropdowns (in main edit screen and in quick edit). Replace the 'my_custom_post_type' with your custom post type name. function my_test($args) { global $post_type_object; if ( $post_type_object->name == 'my_custom_post_type') { $args['depth'] = 1; } ...


0

got it working now... I added a counter $i = 0; $childnum = count($children); just after the if statement of the children. & added this code if ($i == $childnum - 1) { $output .= '<div class="viewmore">'. $viewmore .'</div>'; } $i++; after the the code: $output .= '<div ...


1

This will get you the post data for all child pages: $args = array( 'post_type' => 'page', 'post_parent__not_in' => array(0), 'no_found_rows' => true, ); $child = new WP_Query($args); var_dump(wp_list_pluck($child->posts,'post_title')); // debugging only Then pass the IDs to ...


0

Try using the following code to generate the child pages. <?php // Set up the objects needed $my_wp_query = new WP_Query(); // Query all pages $all_wp_pages = $my_wp_query->query(array('post_type' => 'page')); $page_ids = get_all_page_ids(); $page_children = get_page_children( $page_ids, $all_wp_pages ); echo '<li>' . print_r( ...


0

If you're really just looking to get a list of children with wp_list_pages(), then you should use the child_of parameter to do so. But I'm assuming you're actually want to restrict that list to a certain time frame, for this wp_list_pages(), which uses get_pages(), isn't really good equipped. So I'm thinking you should use get_posts() - or even WP_Query ...



Top 50 recent answers are included