Community Forums › Forums › Archived Forums › General Discussion › Remove Page Titles
Tagged: remove page titles
- This topic has 7 replies, 5 voices, and was last updated 10 years, 5 months ago by Marcy.
-
AuthorPosts
-
September 25, 2013 at 2:22 pm #64149weborizationMember
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’ );
http://192.185.225.20/~everly/series/
/**
* 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’ );
}September 25, 2013 at 5:01 pm #64181MarcyParticipantThe 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' );
Marcy | Amethyst Website Design | Twitter
October 25, 2013 at 6:21 pm #68969eawilkesMemberIs there a way to do this for a single pager or specific pages?
October 25, 2013 at 10:30 pm #69005MarcyParticipantYes, you just have to use a WordPress conditional statement.
They are all listed here: http://codex.wordpress.org/Conditional_TagsYou can use page id's or slugs
Here is an example of a page with id 42if ( 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 ) ) { }
Marcy | Amethyst Website Design | Twitter
October 26, 2013 at 12:21 am #69015RealtyCandyMemberIf 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
October 28, 2013 at 7:41 am #69435eawilkesMemberThanks James, I'll give that a try!
November 12, 2013 at 3:12 pm #72563Ben SiegfriedMemberMarcy, 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?November 12, 2013 at 4:13 pm #72573MarcyParticipantYes, 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.
Marcy | Amethyst Website Design | Twitter
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.