• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Remove Date From Single Posts In Genesis

This question comes from a member of the Genesis community:

Does anyone have a quick resource on how to remove the date from your blog posts? I don’t mean in the actual link, but on my actual blog posts. I’d like to remove the date that appears beneath the blog post title. Thank you!

The code in this tutorial, removes the post date from single posts only so it still displays on all types of archive pages.

If you go to the StudioPress Code Snippets page, you’ll find dozens of code snippets you can use “as is” or modify like the following PHP code snippet.

Using FTP and a code editor, add the above PHP code to the end of your child themes functions.php file.

How The Code Works

The code uses the genesis_post_info filter located around line 280 in genesis > lib > structure > post.php which enables you to hook in to the default function in Genesis and modify the default functionality conditionally so we can return 2 different values based on whether WordPress is loading a single post or not.

In this case, we create 2 variables.

The 1st variable $single_post_info removes the post date shortcode.

The 2nd variable $default_post_info includes the post date shortcode.

We then use a ternary operator which basically says, if it’s a single post, return the value for the $single_post_info variable otherwise return the value for the $default_post_info variable.

Other Methods

There are also other methods you can use to code this solution using PHP.

Using FTP and a code editor, you can create a single.php file in your child theme folder using the following PHP code.

Entry Meta

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags