Remove ‘Post Title’ from Pages on WordPress w/Genesis Theme Framework

Genesis Framework for WordPressThere are so many ways to customise the themes that you use with WordPress.  I have chosen to mainly use the Genesis Theme Framework by Studio Press because the developers have added good SEO features and provide great support.  I’ve been able to do a lot of customisation to sites by using the various child themes and editing the CSS.  They’ve also added some plugins to make it easier for me and clients to update commonly edited areas of the site (like removing author name from posts, etc.)  Sometimes I edit the functions.php file of the child theme in order to add widgets, add/remove/edit other areas on pages.  Sometimes I get the code to do this from the Studio Press support forum when specific to the theme, other times from the WordPress.org Support Forum (support only for those that have purchased themes) and also by just ‘Googling’ what I am looking for and finding it on a helpful blog on the topic.  Some of these customisations are so good I want to use them on all sites and pretty much remember how to do them off the top of my head. Some are only applicable to certain situations and are only needed once in awhile, so then I need to go digging back into old work to see what I had done — or I need to start from scratch looking through forums again.  I’ve decided that I will now document this customisations in this blog so that I can easily find them again, and perhaps help others looking for similar solutions.

Remove ‘Post Title’ from All Pages & Posts

In functions.php add the following:

//REMOVE POST TITLE FROM ALL PAGES AND POSTS
add_action(‘genesis_before’, ’child_conditional_actions’);
function child_conditional_actions() {
if ( is_page() )
remove_action(‘genesis_post_title’, ’genesis_do_post_title’);
}

Remove ‘Post Title’ from Homepage Only

In functions.php add the following:

//REMOVE POST TITLE FROM HOMEPAGE ONLY
add_action(‘genesis_before’, ’child_conditional_actions’);
function child_conditional_actions() {
if ( is_home() )
remove_action(‘genesis_post_title’, ’genesis_do_post_title’);
}

Remove ‘Post Title’ from ‘Front Page’

To be used when you have indicated a specific page to be used for the front page of the site under Settings-General.

In functions.php add the following:

//REMOVE POST TITLE FROM FRONT PAGE
add_action(‘get_header’, ‘child_remove_page_titles’);
function child_remove_page_titles() {
if ( is_front_page() )
remove_action(‘genesis_post_title’, ‘genesis_do_post_title’);
}

Remove ‘Post Title’ from a Specific Page (other than the Homepage or Front Page)

In functions.php add the following:

//REMOVE PAGE TITLE FROM ABOUT US PAGE
add_action(‘genesis_before’, ‘child_conditional_actions’);
function child_conditional_actions() {
if(is_page(‘about-us’ ))
remove_action(‘genesis_post_title’, ‘genesis_do_post_title’);
}

To indicate which specific page to apply the condition to you can use the page title, the page slug or the ID number. (Thanks to http://www.techforluddites.com/2010/01/thesis-applying-functions-only-to-specific-pages.html for providing this information.  Check out that post and http://www.inforats.com/set-a-wordpress-widget-to-appear-on-some-pages/ for more information on conditional statements for a variety of functions.)

Remove ‘Post Title’ from More than One Page

In functions.php add the following using a double bar to separate the different pages:

//REMOVE PAGE TITLE FROM INDICATED PAGES
add_action(‘genesis_before’, ‘child_conditional_actions’);
function child_conditional_actions() {
if(is_front_page() || is_page(‘about-us’ ) || is_page (‘contact-us’ ))
remove_action(‘genesis_post_title’, ‘genesis_do_post_title’);
}

Thanks to @Nick_theGeek for the original code snippet from the Studio Press forum. I then picked up how to make it work for my specific need (Front Page) from a few other posts with similar situations.

This specific code may not work with your theme, but if you look at the code you may be able to see how you can apply it to suit you.

Let me know if you have any other tips on this or any other useful WordPress or Genesis Theme Framework customisation ideas.

  • http://twitter.com/Shenkitup Nate Shenk

    How would I go about removing post titles on all single posts, but not other areas, say, search results? I am currently using:

    /** Custom post titles */
    remove_action( ‘genesis_post_title’,'genesis_do_post_title’ );

    But the code obviously removes all post titles from my site. I have tried an exhausting amount of codes from your site and every other I could fine, but it seems no one else has wanted this specific tweak done. Or I could just be stupid.

    • Ann Donnelly

      Sorry Nate, I didn’t see this comment until now. Will have a look. I found it took a lot of trial and error to get just what I wanted.

      Did you try? -> if(is_single()

      So it would look like this:

      //REMOVE POST TITLE FROM ALL PAGES AND POSTS
      add_action(‘genesis_before’, ‘child_conditional_actions’);
      function child_conditional_actions() {
      if ( is_single() )
      remove_action(‘genesis_post_title’, ‘genesis_do_post_title’);
      }

  • http://www.activosenred.com activosenred

    Thanks for your post. I’m trying to remove a title from a specific post, “tunning” one of the code that you provide, but I didn’t had success.

    I’m sure that something i do wrong

    • Ann Donnelly

      Because I only use this once and awhile, it always takes me a lot of playing around to get it to work.
      - Check if the code is working if you apply it to all post/pages. Then at least you can narrow down where the problem is.
      - Check that you are using the right ID for the post. Easiest if you use the number rather than ‘name’ of it.

      Good luck!