• 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

Hide or remove post date on archive tempalte

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 › Hide or remove post date on archive tempalte

This topic is: resolved

Tagged: archive template, category template, functions.php, post-date

  • This topic has 6 replies, 3 voices, and was last updated 7 years, 1 month ago by cpaone.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • January 28, 2016 at 12:40 pm #177752
    cpaone
    Member

    I am trying to hide or remove the post date on my archive template, only (I want it to appear on the individual post). I only want the featured image and post title to appear on my archive.

    I was able to hide all other elements except the post date with adding this code to my functions.php - does anyone know the proper hooks to remove the post date on the workstation pro theme?

    // Remove Post Info, Post Meta from Archive Pages
    function themeprefix_remove_post_meta() {
    if (is_archive()) {
    remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    }
    }
    add_action ( 'genesis_entry_header', 'themeprefix_remove_post_meta' );

    http://designerbenchmark.com
    January 28, 2016 at 5:19 pm #177780
    Brad Dalton
    Participant
    add_filter( 'genesis_post_info', 'sp_post_info_filter' );
    function sp_post_info_filter($post_info) {
    if ( is_archive() ) {
    	$post_info = 'by [post_author_posts_link] [post_comments] [post_edit]';
    	return $post_info;
        }
    }
    
    Using a code editor, add the above PHP to the end of your child themes functions file.
    
    Change the conditional tag if needed.

    Tutorials for StudioPress Themes.

    January 28, 2016 at 6:32 pm #177785
    cpaone
    Member

    thanks for the reply but the above code suggested to add to the php functions file actually breaks the site?

    January 28, 2016 at 6:42 pm #177786
    Brad Dalton
    Participant

    The code comes from StudioPress and has been used millions of times.

    Did you add the code using FTP and a code editor?

    I tested it and it does not break.


    Tutorials for StudioPress Themes.

    January 28, 2016 at 6:50 pm #177788
    cpaone
    Member

    Thanks for testing.

    I still get the same issue - a blank site

    I copy/ pasted the code to the end of my child theme functions.php file, then uploaded it (as a replacement) via ftp - do you know what I might be doing wrong here? Appreciate the support

    January 28, 2016 at 10:20 pm #177792
    Genesis Developer
    Member

    Remove the old code and try this one

    add_filter( 'genesis_post_info', 'gd_post_info_filter' );
    function gd_post_info_filter( $post_info ) {
    
      if ( is_archive() ) {
    	 $post_info = __( 'by' ) . ' [post_author_posts_link] [post_comments] [post_edit]';
      }
      
      return $post_info;
      
    }

    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    January 29, 2016 at 1:06 am #177799
    cpaone
    Member

    Thanks for the help, both code samples helped me find the solution...

    Turns out the 'sp_post_info_filter' was already in use earlier in the functions file and I did not see it (I am new to this). Here is what I ended up doing to get the results I wanted...

    //* 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 = '[post_date]';
    if ( is_archive() ) {
    $post_info = '';
    }
    return $post_info;
    }

    // Remove Post excerpt, Post Meta from Archive Pages
    add_action ( 'genesis_entry_header', 'themeprefix_remove_post_meta' );
    function themeprefix_remove_post_meta() {
    if (is_archive()) {
    remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    }
    }

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

© 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