Community Forums › Forums › Archived Forums › Design Tips and Tricks › Hiding Page Titles not working
Tagged: Hide title on Home page
- This topic has 7 replies, 3 voices, and was last updated 8 years, 9 months ago by vtolbert.
-
AuthorPosts
-
February 22, 2013 at 6:46 am #22209chantal2012Member
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
February 22, 2013 at 8:21 am #22224cehwithamMemberIt 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
February 22, 2013 at 8:35 am #22226chantal2012MemberI'm not really familiar with PHP 🙁 . I was hoping to settle this with CSS.
February 22, 2013 at 8:38 am #22227cehwithamMemberSetting 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
February 22, 2013 at 8:55 am #22231chantal2012MemberI 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.February 22, 2013 at 4:26 pm #22303cehwithamMemberI 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
June 9, 2015 at 10:43 am #155587vtolbertParticipantI'm trying to hide the home page title in Outreach Pro on this site: http://www.clarkfinancialadvisors.com/dev/
I think I have tried every possible CSS selector and combination and I also adjusted the front-page.php using the info above, all with no results. Can you offer advice?June 9, 2015 at 12:45 pm #155610vtolbertParticipantNever mind. I found a way around.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.