• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Genesis "Remove Post Info" code snippet not working…

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Genesis "Remove Post Info" code snippet not working…

This topic is: not resolved

Tagged: .post-info, move post date

  • This topic has 7 replies, 3 voices, and was last updated 8 years, 6 months ago by mairagall.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • March 1, 2015 at 2:30 pm #142762
    LeaChristine
    Member

    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 #142770
    Victor Font
    Moderator

    This 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 #142773
    LeaChristine
    Member

    Thanks, 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 #142780
    Victor Font
    Moderator

    Okay, 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 #142898
    LeaChristine
    Member

    Thank you so much, this worked perfect! I appreciate your help! 🙂

    March 10, 2015 at 1:49 pm #143936
    mairagall
    Member

    Hello, 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 #143937
    LeaChristine
    Member

    Hi 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!

    Lea
    http://www.leachristinedesigns.com/

    March 10, 2015 at 4:10 pm #143951
    mairagall
    Member

    Thanks Lea! Yes, I read about the code snippets after I found this other code that worked for me.

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble