Opened 9 years ago
Last modified 4 years ago
#35416 new enhancement
List children pages of another (in dashboard)
Reported by: | selnomeria | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | ui, administration | Cc: |
Description
In Dashboard, in "ALL POSTS" page,
there is available to list POSTS of specific categories..
it is good, if such thing was possible for PAGES,
when i have hundreds of pages, then i want to show only specific page's children pages...
please add this posibility (like url :
/wp-admin/edit.php?parent=2754&post_status=all..................
Attachments (3)
Change History (13)
#1
@
9 years ago
- Component changed from General to Posts, Post Types
- Focuses ui administration added
#3
@
7 years ago
(I am OP selnomeria.. it was my old user).
here is solution.
it's good if you added as a patch, because i am not familiar with adding patch in core myself...
add_action('init', 'parented_posts_initialize',11); function parented_posts_initialize(){ $p_types = array('post','page'); //get_post_types() $parented_post_types = apply_filters('parented_posts_filter',$p_types ); foreach($parented_post_types as $each){ add_filter('manage_edit-'.$each.'_columns', 'create_parented_column'); add_action('manage_'.$each.'_posts_custom_column', 'parented_column_func', 10, 2 ); add_filter('manage_edit-'.$each.'_sortable_columns', 'make_parent_column_sortable' ); } } function create_parented_column($columns) { $columns['parents'] =__('parents'); return $columns; } function parented_column_func( $column_name, $post_id ) { if ( 'parents' != $column_name ) return; //Get number of parents from post meta $parentId = wp_get_post_parent_id( $post_id ) ; $parent_p= get_post($parentId); if($parentId != $post_id && $parentId !=0){ $url = $_SERVER['REQUEST_URI']; $url = add_query_arg('parent_id', $parentId, $url ); $url = add_query_arg('orderby', 'parent', $url ); echo '<a href="'.$url.'">'.$parent_p->post_name.'</a>'; return; } echo ($finalParent); } function make_parent_column_sortable( $columns ) { $columns['parents'] = 'parent'; // to remove: unset($columns['date']); return $columns; } add_action( 'pre_get_posts', 'my_slice_orderby' ); function my_slice_orderby( $query ) { if( ! is_admin() ) return; global $pagenow; if ( ( $pagenow == 'edit.php' ) ) { // && ( 'slices' == $query->get( 'orderby')) if(isset($_GET['parent_id'])){ $query->set('post_parent', (int) $_GET['parent_id'] ); } } }
user can use filter to add his desirable custom filter:
add_filter('parented_posts_filter', 'myparented_fitlers',10,1); function myparented_fitlers($post_types=array()){ return array_merge($post_types, array('my_custom_type') ); }
#4
@
7 years ago
Yes, we have had this business request, too. One thing that has helped us without this core functionality is to use this CMS Tree Page View plugin: http://eskapism.se/wordpress/cms-tree-page-view/. Is that similar to what you wanted, maybe in a different way?
#5
@
7 years ago
@kpegoraro I think that solution should be even included in CORE! that will take WP administration of pages/posts into the higher stage.
#7
@
5 years ago
I am re-posting from this another topic (which was closed as duplicate for this topic), so I am attaching my patch here (@shital-patel seems you copied my attached patch, thanks, but I have modified it again as Sergey suggested in that topic), and I am also adding screenshots:
Here screenshot -
left side is original, clicking on the parent slug makes the table sorted (as on the right screenshot)
The attached patch is just my approximation, but I doubt that it will need some modification or revision, because I've added "post_parent" in public_query_vars
#8
@
5 years ago
@swissspidy @DrewAPicture , now, the patch is added.
Hi @selnomeria, are you saying that you want to add something like
parent=###
support to the posts list table (used for all post types)? If so, would you be interested in submitting a patch?