Community Forums › Forums › Archived Forums › Design Tips and Tricks › Genesis "Remove Post Info" code snippet not working…
Tagged: .post-info, move post date
- This topic has 7 replies, 3 voices, and was last updated 9 years, 8 months ago by mairagall.
-
AuthorPosts
-
March 1, 2015 at 2:30 pm #142762LeaChristineMember
Not sure if anyone else has experienced this problem-- when I try to remove the post info (date-author-comment link) from my posts using the StudioPress code snippet (http://my.studiopress.com/snippets/post-info/) it doesn't work... I did use the raw code too.
Any ideas? I want to move the post date of my posts to be above the post title, not below...
Site URL: http://sample.leachristinedesigns.com/
http://sample.leachristinedesigns.com/March 1, 2015 at 4:29 pm #142770Victor FontModeratorThis is because the post info isn't in genesis_before_post_content it is in genesis_entry_header. You need something like this:
//* Relocate the post info remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); add_action( 'genesis_entry_header', 'genesis_post_info', 5 );
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 1, 2015 at 5:27 pm #142773LeaChristineMemberThanks, this is a bit closer to what I'm trying to do... is there any way you know of to only move the post date above the title, but not the author or comment links?
March 1, 2015 at 7:24 pm #142780Victor FontModeratorOkay, so this is what you need to do. Remove the above code and add this instead:
add_action( 'genesis_entry_header', 'my_post_info', 5 ); add_filter( 'my_post_info', 'do_shortcode', 20 ); function my_post_info() { if ( 'page' === get_post_type() ) return; $output = genesis_markup( array( 'html5' => '<p %s>', 'xhtml' => '<div class="my-post-info">', 'context' => 'entry-meta-before-content', 'echo' => false, ) ); $output .= apply_filters( 'my_post_info', '[post_date]' ); $output .= genesis_html5() ? '</p>' : '</div>'; echo $output; }
The above block moves the date above the post. Use the snippet from the page you referenced above to modify the info under the title.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 2, 2015 at 1:22 pm #142898LeaChristineMemberThank you so much, this worked perfect! I appreciate your help! 🙂
March 10, 2015 at 1:49 pm #143936mairagallMemberHello, I want to do the same as Lea Christine, I added both codes to my functions.php file, but the date below the post title is still there, now I have two post dates, any suggestion (I'm using Genesis Sample).
Thanks!
EDIT: I fixed it with this code:
//* Remove the post info function remove_action( 'genesis_before_post_content', 'genesis_post_info' ); add_action( 'genesis_entry_header', 'my_post_info', 5 ); add_filter( 'my_post_info', 'do_shortcode', 20 ); function my_post_info() { if ( 'page' === get_post_type() ) return; $output = genesis_markup( array( 'html5' => '<p %s>', 'xhtml' => '<div class="my-post-info">', 'context' => 'entry-meta-before-content', 'echo' => false, ) ); $output .= apply_filters( 'my_post_info', '[post_date]' ); $output .= genesis_html5() ? '</p>' : '</div>'; echo $output; } add_filter( 'genesis_post_info', 'lc_post_info_filter' ); function lc_post_info_filter($post_info) { $post_info = 'by [post_author_posts_link] [post_comments] [post_edit]'; return $post_info; }
March 10, 2015 at 1:54 pm #143937LeaChristineMemberHi Mairagall-- so in addition to what was posted above, I had to also change the original post info--
//* Customize the post info function add_filter( 'genesis_post_info', 'sp_post_info_filter' ); function sp_post_info_filter($post_info) { if ( !is_page() ) { $post_info = ' By [post_author_posts_link] [post_comments] [post_edit]'; return $post_info; }}
So, where you see $post_info = it used to also have the [post_date] listed, I just took that out and capitalized the "B" on "by." Hope this helps!
March 10, 2015 at 4:10 pm #143951mairagallMemberThanks Lea! Yes, I read about the code snippets after I found this other code that worked for me.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.