• 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

Custom field and post_info

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 › General Discussion › Custom field and post_info

This topic is: resolved

Tagged: custom field

  • This topic has 4 replies, 2 voices, and was last updated 9 years, 10 months ago by sbn128.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • July 30, 2015 at 11:14 am #160954
    sbn128
    Member

    Hello! Please, help! How to include custom field to post_info? I tried to do as follows:

    add_action('genesis_post_info', 'answer_author_name');
    function answer_author_name() {
    if ( is_single() && genesis_get_custom_field('wpcf-name-author') )
    echo '<span class="entry-author">Answer by: '. genesis_get_custom_field('wpcf-name-author') .'</span>';
    return $post_info;
    }
    

    but it does not work. I am a novice genesis user and bad speak english. Please help.

    July 30, 2015 at 11:55 am #160961
    Victor Font
    Moderator

    If you're using the code as you posted it, it will never work. It's not PHP code.

    add_action('genesis_post_info', 'answer_author_name');
    function answer_author_name() {
    if ( is_single() && genesis_get_custom_field('wpcf-name-author') )
    echo '<span class="entry-author">Answer by: '.  genesis_get_custom_field('wpcf-name-author') .'</span>';
    return $post_info;
    }

    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    July 30, 2015 at 12:09 pm #160963
    sbn128
    Member

    But how to make that work?

    My single-answers.php code:

    &lt;?php
    /**
     * Answers post type single post template
     */
    
    add_action('genesis_post_info', 'answer_author_name');
    function answer_author_name() {
    if ( is_single() &amp;&amp; genesis_get_custom_field('wpcf-name-author') )
    echo '&lt;span class="entry-author"&gt;Answer by: '.  genesis_get_custom_field('wpcf-name-author') .'&lt;/span&gt;';
    return $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 = '[post_date]';
    	return $post_info;
    }}
     
    genesis();

    And it works partly, but appears in the wrong place:

    Screenshot

    July 30, 2015 at 6:49 pm #160997
    Victor Font
    Moderator

    You only need one function for what you want.

    //* Customize the entry meta in the entry header (requires HTML5 theme support)
    add_filter( 'genesis_post_info', 'sp_post_info_filter' );
    function sp_post_info_filter($post_info) {
    	$post_info = '<span class="entry-author">Answer by: '.  genesis_get_custom_field('wpcf-name-author') .'</span> [post_date]';
    	return $post_info;
    }

    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    July 31, 2015 at 1:10 pm #161091
    sbn128
    Member

    Thank you very much, Victor. It's work.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘General Discussion’ 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

© 2025 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