The WordPress Expert |
How to Remove Dates from WordPress Posts Posted: 01 Jun 2011 10:27 AM PDT If your content is not time-oriented (such as when using WordPress in non-blog contexts), you may wish to remove the publication date from your posts since this information is not relevant and can give the impression that your older content is outdated. 1. The Manual MethodThe “proper” way to do this would be to edit your theme and remove the code that displays the post dates.
2. The Automatic MethodIf you’re looking for a quick fix, just go to “Appearance > Editor” in your WordPress admin and add this code to the top of your theme’s functions.php file: function jl_remove_post_dates() { add_filter('the_date', '__return_false'); add_filter('the_time', '__return_false'); add_filter('the_modified_date', '__return_false'); } add_action('loop_start', 'jl_remove_post_dates'); (Note: This method requires WordPress 3.0 or above) Now check your site and verify that the post dates are gone. If they’re not, try replacing the code above with this more “aggressive” version: function jl_remove_post_dates() { add_filter('the_date', '__return_false'); add_filter('the_time', '__return_false'); add_filter('the_modified_date', '__return_false'); add_filter('get_the_date', '__return_false'); add_filter('get_the_time', '__return_false'); add_filter('get_the_modified_date', '__return_false'); } add_action('loop_start', 'jl_remove_post_dates'); |
You are subscribed to email updates from WordPress Expert To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment