Community Forums › Forums › Archived Forums › Design Tips and Tricks › Removing entry header for post formats
Tagged: post format
- This topic has 9 replies, 3 voices, and was last updated 8 years, 8 months ago by
RitzyThemes.
-
AuthorPosts
-
December 29, 2014 at 8:32 am #135536
Anonymous
InactiveHi all,
Trying to remove the entry header for some post formats and can't seem to get things working. I'm using the sixteen nine child theme, and tried adding this to my functions.php file, but no luck.
remove_action( 'genesis_post_title','genesis_do_post_title' ); add_action( 'genesis_post_title','post_format_post_title' ); /** * Remove Post Title with conditional tag. * */ function post_format_post_title() { if ( has_post_format('aside') ) { remove_action( 'genesis_post_title','genesis_do_post_title' ); }}
Any advice on how to do this?
http://pedalandrevel.comDecember 29, 2014 at 9:17 am #135541rfmeier
Memberptcjosh,
In your code, you are attempting to remove the action while in the action callback. You will need to remove the action a little earlier to get what you are looking for. I included an example within the gist below;
From the code you can decide what needs to be removed and/or what post formats to remove the entry header.
December 29, 2014 at 9:22 am #135542Anonymous
InactiveThanks, Ryan. Am I missing something, not seeing the Gist?
December 29, 2014 at 9:35 am #135543Anonymous
InactiveI've updated things b/c I realized I wasn't using the right HTML5 hooks. I'm now at:
remove_action( 'genesis_entry_header','genesis_do_post_title' ); add_action( 'genesis_entry_header','post_format_post_title' ); function post_format_post_title() { if ( has_post_format('aside') ) { remove_action( 'genesis_entry_header','genesis_do_post_title' ); }}
This removes the title from all posts, not what I'm trying to do. Just want to remove them from selected post formats. TIA.
December 29, 2014 at 10:12 am #135548rfmeier
MemberGah, sorry.
I have no idea what is going on with their forums in recent. I have had links stripped from my posts a lot lately.
https://gist.github.com/rfmeier/4805035bd30ab7e17f76
December 29, 2014 at 2:01 pm #135587Anonymous
InactiveThanks, Ryan. Unfortunately that didn't seem to work. Entire header info is still visible.
December 29, 2014 at 3:18 pm #135601Anonymous
InactiveSo I have this working kind of, but not really. Basically the Gist you provided removed everything from all posts. Page titles still appear, but posts don't. Thanks again for the help.
December 29, 2014 at 9:46 pm #135625rfmeier
Memberptcjosh,
I am not sure why it wasn't working for you. Are you doing this on a live site?
December 30, 2014 at 6:39 am #135658Anonymous
InactiveHi Ryan,
I was only using it on a local site but just pushed it to the live site so you can have a look. It seems to be removing the entry header content from all posts after the first instance of a post format encountered in the loop. You can see it here: pedalandrevel.com
The first post is a standard post, the second an aside, the rest, standards.
January 16, 2015 at 9:41 pm #137732RitzyThemes
MemberHi ptcjosh,
you can do that by simply,
add_action( 'genesis_before_entry', 'childtheme_before_entry' ); /** * childtheme_before_entry */ function childtheme_before_entry() { //* get the post format $post_format = get_post_format(); if ( $post_format == 'aside' ) { remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); remove_action( 'genesis_post_title', 'genesis_do_post_title' ); } else { add_action( 'genesis_entry_header', 'genesis_do_post_title' ); add_action( 'genesis_post_title', 'genesis_do_post_title' ); } }
i hope, it will work for you.
Get free and premium Genesis Child Themes
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.