Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function manage_mytype_columns( $column, $post_id ) {
- global $post;
- $pp_id = get_post($post_id)->post_parent; /*The post parent id is stored also as post meta, so I could also use $pp_id = get_post_meta($post_id, 'post_parent', true) ); */
- if ( empty( $pp_id ) ) {
- echo __( 'No post parent' );}
- else {
- $pp_title = get_post($pp_id)->post_title;
- echo $pp_title; }
- }
- add_action( 'manage_mytype_posts_custom_column', 'manage_mytype_columns', 10, 2 );
- function manage_mytype_columns( $column, $post_id ) {
- global $post;
- $pp_id = get_post($post_id)->post_parent; /*The post parent id is stored also as post meta, so I could also use $pp_id = get_post_meta($post_id, 'post_parent', true) ); */
- if ( empty( $pp_id ) ) {
- echo __( 'No post parent' );}
- else {
- $pp_title = get_post($pp_id)->post_title;
- $pp_url = add_query_arg(array('post_type' => $post->post_type, 'post_parent' => $pp_id), 'edit.php');
- echo '<a href="'.$pp_url.'">'.$pp_title.'</a>'; }
- }
- add_action( 'manage_mytype_posts_custom_column', 'manage_mytype_columns', 10, 2 );
- function make_post_parent_public_qv() {
- if ( is_admin() )
- $GLOBALS['wp']->add_query_var( 'post_parent' );
- }
- add_action( 'init', 'make_post_parent_public_qv' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement