Displaying Post Title on Post Edit page?

This will do it: function edit_screen_title() { global $post, $title, $action, $current_screen; if( isset( $current_screen->post_type ) && $current_screen->post_type == ‘post’ && $action == ‘edit’ ) $title=”Edit ” . $post->post_title; } add_action( ‘admin_head’, ‘edit_screen_title’ );

Post type archive page not working

Given the standard registration, you should have the following: A post type with the name ‘recipe’ A recipe post archive at example.com/recipe/ Recipe posts with urls that take the form example.com/recipe/helloworldrecipe/ A template archive-recipe.php A template single-recipe.php However, I see this in your registration code: ‘rewrite’ => array(‘slug’ => ”), This suggests what you’re trying … Read more

Custom post type archive with pagination?

As you can see in the rewrite analyzer, /projects/page/2/ sets projects=page&page=/2 instead of pagename=projects&paged=2 as we would like. So you just need to add a rewrite rule for this special case (in the register_projects() function, after you register your custom post type, would be a good place): add_rewrite_rule( ‘projects/page/([0-9]+)/?$’, ‘index.php?pagename=projects&paged=$matches[1]’, ‘top’ ); Remember to flush … Read more

Custom Post Type with Custom Title

You can try the following code. function custom_post_type_title ( $post_id ) { global $wpdb; if ( get_post_type( $post_id ) == ‘cars’ ) { $engine=”, “.get_post_meta($post_id, ‘Engine’, true).’l’; $terms = wp_get_object_terms($post_id, ‘brand’); $abrand= ‘ ‘.$terms[0]->name; $amodel=” “.$terms[1]->name; $title = $post_id.$abrand.$amodel.$engine; $where = array( ‘ID’ => $post_id ); $wpdb->update( $wpdb->posts, array( ‘post_title’ => $title ), $where ); … Read more

Refine custom posts by author

Three steps need to be followed to accomplish it. 1. Add rewrite rules add_action(‘generate_rewrite_rules’, ‘author_cpt_add_rewrite_rules’); function author_cpt_add_rewrite_rules( $wp_rewrite ) { $new_rules = array( ‘author/(.+)/(.+)’ => ‘index.php?author=”.$wp_rewrite->preg_index(1) . “&post_type=” .$wp_rewrite->preg_index(2) ); //​ Add the new rewrite rule into the top of the global rules array $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } 2. Redirect to specific templates … Read more

Creating a gallery custom post type?

Can I show different text for linking to gallery posts ? YES, Here’s how to do it, put this where you want to output text as – readmore/view photos, depending on theme or way you’re generating these text we can use filter to change it as per custom post type. <?php echo ‘<a href=”‘.the_permalink().'”>’; if … Read more