Archived topic
Remove Post Date
21 replies · Started by Gulf State Software on September 3, 2017
Using the CSS solution would only prevent the date to show up on the front end.
This is where we would need to use the filter I suggested above.
Are there any categories you would like the date to show?
For example, the category "comparativa-brokers" should be displaying dates and other data. You can see the links to the images of one post here and here.
As you can see I have all options on in the customizer, however the post does not show anything.
What could be happening there?
---------
As for the filter to remove the date showing in the back end, I do not know but maybe something like this should work?
add_filter( 'option_generate_remove_date', 'remove_date_from_category' );
function remove_date_from_category( $options ) {
if ( categoryx() ) {
$options['date'] = false;
}
return $options;
}
Try this:
add_filter( 'option_generate_blog_settings', 'lh_category_date_settings' );
function lh_category_date_settings( $options ) {
if ( in_category( array( 'category1' , 'category2' , 'category3' ) ) ) {
$options['date'] = false;
}
return $options;
}
add_filter( 'option_generate_blog_settings', 'lh_category_single_date_settings' );
function lh_category_single_date_settings( $options ) {
if ( in_category( array( 'category1' , 'category2' , 'category3' ) ) ) {
$options['single_date'] = false;
}
return $options;
}
Hi
I tried it with one category, but the published date is still beign shown in the source:
<header class="entry-header">
<h1 class="entry-title" itemprop="headline">Revisión de ApexFutures</h1> <div class="entry-meta">
<span class="posted-on"><a href="http://www.mejorbrokerdebolsa.com/revision-de-apexfutures/" title="12:03" rel="bookmark"><time class="updated" datetime="2016-09-05T13:11:17+00:00" itemprop="dateModified">5 septiembre, 2016</time><time class="entry-date published" datetime="2015-04-16T12:03:36+00:00" itemprop="datePublished">16 abril, 2015</time></a></span> </div><!-- .entry-meta -->
</header><!-- .entry-header -->
I will open a new thread with the other thing I asked you about the blog options in the customizer.
Thx
Can you try the edited snippet above?
https://generatepress.com/forums/topic/remove-post-date/page/2/#post-623639
Now, with the edited code the date is removed from the view-source as well.
Using the plugin "code snipets" by the way
Thank you
No problem :)