• 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

How to replace post date on home page posts – Ambiance Pro

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 › How to replace post date on home page posts – Ambiance Pro

This topic is: not resolved

Tagged: ambiance pro

  • This topic has 2 replies, 2 voices, and was last updated 5 years, 3 months ago by skstudio.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • February 3, 2020 at 6:40 pm #496403
    skstudio
    Member

    Hello!
    For Ambiance Pro, how can I replace the date on the homepage posts with a custom field?
    I made a custom field Key called Week.
    I found existing code in the Ambiance Pro index.php file, lines 23-30.

    	//* Customize the entry meta in the entry header
    	remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    	add_action( 'genesis_entry_header', 'ambiance_post_info', 12 );
    	function ambiance_post_info() {
    
    		echo '<p class="entry-meta">' . do_shortcode( '[post_date]' ) . '</p>';
    
    	}
    

    But I am unsure on the steps so the custom field for each post will be displayed on the home page instead of the date.

    Any ideas are helpful.

    Thanks much!

    February 3, 2020 at 7:53 pm #496404
    AnitaC
    Keymaster

    You can create a shortcode for the custom field. Then replace the [post_date] with your shortcode. There are a couple posts on the web on how to do that. Try Ren's tutorial here - https://www.engagewp.com/create-shortcodes-pull-custom-field-data/.


    Need help with customization or troubleshooting? Reach out to me.

    February 3, 2020 at 9:39 pm #496406
    skstudio
    Member

    Anita, Thank you so much! I got it to work with your idea! I studied the site you mentioned above and then searched some more. Here is the code that I ended up with:

    1. Create a shortcode: https://www.wpbeginner.com/wp-tutorials/how-to-add-a-shortcode-in-wordpress/https://www.wpbeginner.com/wp-tutorials/how-to-add-a-shortcode-in-wordpress/
    2. Using https://www.isitwp.com/get-custom-field-value-with-shortcode/ as my inspiration,
    added this my custom functions plugin. You could probably add it to functions.php.

    add_shortcode( 'field', 'sk_week' );
    
    /****************************************************************
     Shortcode to pull custom field
    ****************************************************************/
    add_shortcode('field', 'shortcode_field');
     
    function shortcode_field($atts){
         extract(shortcode_atts(array(
                      'post_id' => NULL,
                   ), $atts));
      if(!isset($atts[0])) return;
           $field = esc_attr($atts[0]);
           global $post;
           $post_id = (NULL === $post_id) ? $post->ID : $post_id;
           return get_post_meta($post_id, $field, true);
    }
    

    3. In the index.php modified the shortcode area
    From:
    echo '<p class="entry-meta">' . do_shortcode( '[post_date]' ) . '</p>';
    To:
    echo '<p class="entry-meta">' . do_shortcode( '[field "sk-prepost-title"]' ) . '</p>';

    Works great!
    Many thanks to you and the community!
    SK

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 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

© 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