Edit or remove post meta from category pages
If you find this tweak helpful:
Beginners
Tweaking Elegant Themes involves creating a child theme and editing PHP and CSS files within a text editor. If you have never done this you may want to read our guide on creating a child theme. All tweaks are written with the assumption that you have a default installation of your theme. Any tweaks or changes you may have previously made to your theme could affect the outcome of the tweaks on this site. All tweaks should be tested before applying to a live site.
While Elegant Theme's epanel lets you edit and remove the author, date, category and comments meta information from the posts and pages, it does not let you edit or remove it from the category pages. This tweak will let you display only certain information or remove it completely. First we'll show you how to edit the information displayed. If you would prefer to remove it completely, skip to the CSS section for a very simple solution.
PHP
Create a new folder in /deepfocus-child/ and name it 'includes'
Locate the entry.php file in /themes/deepfocus/includes/
Save an exact copy of this file to the folder we just created /themes/deepfocus-child/includes/
Locate the following code near line 22:
<div class="entry-description<?php if ($thumb == '' || get_option('deepfocus_thumbnails_index') == 'false') echo(' full-description'); ?>">
<h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php get_template_part('includes/postinfo'); ?>
<?php if (get_option('deepfocus_blog_style') == 'on') { ?>
<?php the_content(); ?>
<?php } else { ?>
<p><?php truncate_post(375); ?></p>
<?php } ?>
<a class="readmore" href="<?php the_permalink(); ?>"><span><?php esc_html_e('Learn More','DeepFocus'); ?></span></a>
</div> <!-- end .entry-description -->
And change it to this:
<div class="entry-description<?php if ($thumb == '' || get_option('deepfocus_thumbnails_index') == 'false') echo(' full-description'); ?>">
<h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php get_template_part('includes/postinfo-custom'); ?>
<?php if (get_option('deepfocus_blog_style') == 'on') { ?>
<?php the_content(); ?>
<?php } else { ?>
<p><?php truncate_post(375); ?></p>
<?php } ?>
<a class="readmore" href="<?php the_permalink(); ?>"><span><?php esc_html_e('Learn More','DeepFocus'); ?></span></a>
</div> <!-- end .entry-description -->
Here we are just changing the source of template from 'postinfo' to a new file we will create called 'postinfo-custom'. Now let's create that file.
Create a new file called 'postinfo-custom.php' and save it to /themes/deepfocus-child/includes/
Add the following code:
<?php if (!is_single() && get_option('deepfocus_postinfo1') ) { ?>
<p class="post-meta"><?php if (in_array('date', get_option('deepfocus_postinfo1'))) { ?><?php the_time(get_option('deepfocus_date_format')) ?><?php }; ?><?php if (in_array('categories', get_option('deepfocus_postinfo1'))) { ?> <?php }; ?><?php if (in_array('comments', get_option('deepfocus_postinfo1'))) { ?> | <?php comments_popup_link(esc_html__('0 comments','DeepFocus'), esc_html__('1 comment','DeepFocus'), '% '.esc_html__('comments','DeepFocus')); ?><?php }; ?></p>
<div class="clear"></div>
<?php } elseif (is_single() && get_option('deepfocus_postinfo2') ) { ?>
<p class="post-meta">
<?php if (in_array('date', get_option('deepfocus_postinfo2'))) { ?><?php the_time(get_option('deepfocus_date_format')) ?><?php }; ?><?php if (in_array('categories', get_option('deepfocus_postinfo2'))) { ?> <?php }; ?><?php if (in_array('comments', get_option('deepfocus_postinfo2'))) { ?> | <?php comments_popup_link(esc_html__('0 comments','DeepFocus'), esc_html__('1 comment','DeepFocus'), '% '.esc_html__('comments','DeepFocus')); ?><?php }; ?>
</p>
<?php }; ?>
This is just a copy of the original postinfo.php with the author and category sections removed. Next we'll show you how to remove the bar completely with a much easier method.
CSS
Locate your style.css file in /deepfocus-child/
Add the following code:
.entry-description .post-meta {
display: none;
}
That's it. The meta rounded box should now be gone.
4 Comments
Does this also work for Divi?
July 5, 2016
I just solved it myself. In Divi it’s way more easy because you can set it up in the theme options. 😀 Made it way too hard for me…
July 5, 2016
In den einzelnen Blogs werden die post meta daten trotzdem angezeigt. Wie kriegt man die weg?
April 10, 2017
how to i add an element to the post_meta in divi . i want to add reading time to the meta description.
July 26, 2017