8 Ways To Remove Titles From Single Custom Post Type Pages

There’s at least 3 ways to remove one or more entry header titles from your single custom post type pages.

  1. You can code PHP different ways to do this in custom functions
  2. Add one line of code to your single custom post type template file
  3. Or simply use CSS code in your style sheet

Which solution you decide to use is your own personal choice and while i love all the cool stuff you can do with CSS, i find PHP more flexible for this specific solution.

Please copy ALL the PHP code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++

Works In Any Theme

Works In Genesis Child Themes Only

And this method:

add_action( 'genesis_before_loop', 'remove_single_custom_post_titles' );
function remove_single_custom_post_titles() {
if ( is_singular( 'portfolio' ) ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    }
}

Or use __return_false with the 2nd parameter in the genesis_post_title_output filter

add_action( 'genesis_before_loop', 'remove_single_custom_post_titles' );
function remove_single_custom_post_titles() {
if ( is_singular( 'portfolio' ) ) {
add_filter( 'genesis_post_title_output', '__return_false' );
    }
}

Or use __return_false with the 2nd parameter in the genesis_post_title_text filter

add_action( 'genesis_before_loop', 'remove_single_custom_post_titles' );
function remove_single_custom_post_titles() {
if ( is_singular( 'portfolio' ) ) {
add_filter( 'genesis_post_title_text', '__return_false' );
    }
}

You could also use __return_empty_string like this:

add_filter( 'genesis_post_title_output', '__return_empty_string' );

Using a Ternary Operator


add_filter( 'genesis_post_title_output', 'remove_single_custom_post_titles' );

function remove_single_custom_post_titles( $title ) {

    $single_titles = '';
    
    $archive_titles = $title;
    
    $title = is_singular( 'portfolio' ) ? $single_titles : $archive_titles;
    
    return $title;
    
}

Add To Single CPT File (Genesis)

If you’re using a single-portfolio.php file, you could simply add this line of PHP code to that file.

Note: If you’re using a archive-portfolio.php and/or a taxonomy-portfolio-type.php file(s), you can add the above line of PHP code directly to the file.

Using CSS

Here’s the CSS code which also gets the job done.

.single-portfolio .entry-title {
    display: none;
}

Or you can even use this as another option depending on which theme you’re using.

.single-portfolio .entry-header {
    display: none;
}

Simply grab the class from the body classes in your source code and use a tool like Firebug to inspect your title to find the class your theme uses for the title.

Related Solutions

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.