Remove Page Titles

Community Forums Forums General Discussion Remove Page Titles

This topic is: not resolved

This topic contains 7 replies, has 5 voices, and was last updated by  Marcy 11 months, 1 week ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #64149

    weborization
    Participant
    Post count: 3

    I’ve used the code below in the functions.php successfully for quite some time and am finding it isn’t working on this site with Epik 1.3 installed. Does something in the code need to be changed specifically for Epik or all around for WordPress 3.6.1 / Genesis 2.0.1?

    Thanks – and I’d rather not use a plugin for this. I’m looking for a code solution.

    //Remove page titles

    add_action( ‘get_header’, ‘child_remove_page_titles’ );
    /**
    * Remove page titles from all pages except blog page template.
    *
    * @author John Wright
    * @link http://dev.studiopress.com/remove-page-titles.htm
    */
    function child_remove_page_titles() {
    if ( is_page() && ! is_page_template( ‘page_blog.php’ ) )
    remove_action( ‘genesis_post_title’, ‘genesis_do_post_title’ );
    }

    http://192.185.225.20/~everly/series/
    #64181

    Marcy
    Participant
    Post count: 381

    The Epik theme is HTML5 and the hooks have changed.

    You would need to change
    remove_action( ‘genesis_post_title’, ‘genesis_do_post_title’ );

    to
    remove_action( ‘genesis_entry_header’, ‘genesis_do_post_title’ );


    #68969

    eawilkes
    Participant
    Post count: 2

    Is there a way to do this for a single pager or specific pages?

    #69005

    Marcy
    Participant
    Post count: 381

    Yes, you just have to use a WordPress conditional statement.
    They are all listed here: http://codex.wordpress.org/Conditional_Tags

    You can use page id’s or slugs
    Here is an example of a page with id 42

    if ( is_page ( 42 ) ) {
         remove_action( ‘genesis_entry_header’, ‘genesis_do_post_title’ );
    }

    Here is a more complex example with mixed slugs and id’s

    if ( is_page( array( 42, 'about-me', 'About Me And Joe' ) ) )  {
         remove_action( ‘genesis_entry_header’, ‘genesis_do_post_title’ );
    }

    If you want to target a post, instead of a page, you would use
    if ( is_single( 53 ) ) { }


    • This reply was modified 11 months, 4 weeks ago by  Marcy.
    • This reply was modified 11 months, 4 weeks ago by  Marcy.
    #69015

    RealtyCandy
    Participant
    Post count: 23

    If you want to do it with CSS, you can do something like:

    .post-77 .entry-title {display: none;}

    Kind of quick and dirty. that post-77 would need to be changed if it is a page instead of a post.

    Good luck,

    James


    #69435

    eawilkes
    Participant
    Post count: 2

    Thanks James, I’ll give that a try!

    #72563

    benjeeno
    Participant
    Post count: 266

    Marcy, your options didn’t work for me and I’m using Agency-Pro. I can get display:none; to work but would like to know why the functions.php method isn’t working. I’m inputting it in as you have shared using a correct page ID and even the title of the page. Are you sure your code is correct?

    #72573

    Marcy
    Participant
    Post count: 381

    Yes, my code is correct, although when I copied and pasted, the quote marks were wrong, so maybe that’s it for you too. Also are you adding the code I pasted above to the function from the OP at the top of this page?

    Here is a working version:

    add_action( 'get_header', 'child_remove_page_titles' );
    
    function child_remove_page_titles() {
    if ( is_page( array( '813', 'about', 'services' ) ) ) {
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
    }
    }

    I also removed the title and the entry header markup because I don’t like empty markup.


Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.