Hiding Page Titles not working

Community Forums Forums Design Tips and Tricks Hiding Page Titles not working

This topic is: not resolved

This topic contains 5 replies, has 2 voices, and was last updated by  cehwitham 1 year, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #22209

    chantal2012
    Participant
    Post count: 60

    I want to hide the “home” title from my home page….I followed this tutorial  http://wpsites.net/web-design/hide-page-titles-from-displaying/  but it doesn’t work.  This is the code that I put in my custom.css file:

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

    It works when I try it in Firebug, but doesn’t when added to css file?  My site is http://auntieshauntie.com

    #22224

    cehwitham
    Participant
    Post count: 396

    It seems odd that your CSS isn’t working, have you got any cache plugins installed?

    A better way to achieve this is to use the following to remove the page title:

    remove_action( 'genesis_post_title', 'genesis_do_post_title');

    You’ll need to create a front-page.php template file in your child theme folder and then add the code in there.

    Your front-page.php file should be something like this:

    <?php
    remove_action( 'genesis_post_title', 'genesis_do_post_title');
    genesis();

    I hope that helps.

    Chris


    Twitter: cehwitham Web: cehwitham.com

    #22226

    chantal2012
    Participant
    Post count: 60

    I’m not really familiar with PHP :( .  I was hoping to settle this with CSS.

    #22227

    cehwitham
    Participant
    Post count: 396

    Setting display:none on titles isn’t really a great way to go but if you want to do it with CSS only then adding the following to your style.css file should work fine:

    .home #content .post-2 .entry-title {
    display: none;
    }

    Where is your custom.css file?


    Twitter: cehwitham Web: cehwitham.com

    #22231

    chantal2012
    Participant
    Post count: 60

    I was able to make the home title disappear with this code which I found online and it worked perfectly:

    add_action(‘get_header’, ‘child_remove_page_titles’);
    function child_remove_page_titles() {
    $pages=array();
    if (is_page(‘2′)) {
    remove_action(‘genesis_post_title’, ‘genesis_do_post_title’);
    }
    }

    My custom.css file is in my child theme…I used to work with Thesis and I really got used to working with a custom.css file.  It was so easy, put changes in there and you could view the changes instantly.  With Genesis, there is no custom.css file (Lifestyle theme) so I had to create one.  I added this code to my functions.php file to do this:
    add_action( ‘wp_enqueue_scripts’, ‘enqueue_custom_stylesheet’ );
    function enqueue_custom_stylesheet() {
    wp_register_style( ‘custom-css’, get_stylesheet_directory_uri() . ‘/custom.css’ );
    wp_enqueue_style( ‘custom-css’ );
    }
    Everything has been working great so far…however, I just noticed that not everything works when I put it in custom.css.  For instance, once I finally got rid of the home title, I had to adjust the margins for the content on the homepage.  I put this code in my custom.css file (which worked in Firebug):
    .post-2.page.type-page.status-publish.hentry {
    margin-top: 90px;
    }
    It didn’t work in custom.css file but when I put it in style.css, it worked…weird…I was told not to put anything at the end of the style.css sheet because it would cause duplicate elements.  I don’t know which way is the best way to work when it comes to this.

    #22303

    cehwitham
    Participant
    Post count: 396

    I think you’ll want to use enqueue styles rather than enqueue scripts to add a second stylesheet more info at: http://codex.wordpress.org/Function_Reference/wp_enqueue_style

    Basically it’s better to make style changes in style.css as you can overwrite the original styles rather than having to load a separate stylesheet to overwrite the styles. You’d only end up with duplicate properties if you added styles to the style.css file that were already defined further up the file. If you add a custom.css file, any styles you add to there that are already defined in style.css will be duplicates.

    Chris


    Twitter: cehwitham Web: cehwitham.com

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

You must be logged in to reply to this topic.