Archived topic
Adding a line to 'footer entry meta' before the category links
7 replies · Started by Michael Alø-Nielsen on March 21, 2018
How can I add a line to the footer entry meta just before the category links?
I want it to be inside the meta (at the top - before the category links) but still retaining the original meta content.
Hi there,
An actual line like a border?
On main blog page or single posts or both?
No. When I said "line", I meant a line of text.
Actually what I want is an icon and some text just like the categories or the tags.
If a post is in a specific category, I want to show an Icon and the last word from the post title. I have the code to show what I want ready (see below). I Just don't know where to put it.
<?php if ( in_category('now-playing') ) : ?>
<i class="fa fa-registered fa-lg fa-fw" aria-hidden="true" style="color:#3d3d3d;"></i> <span title="Min subjektive bedømmelse"><?php $post_title = get_the_title(); $title_as_array = explode(' ', $post_title); $last_word = array_pop($title_as_array); echo $last_word; ?></span>
<?php endif; ?>
And I would like it to show on main blog and archive pages not single posts.
You could try this:
add_action( 'generate_after_entry_content', 'tu_add_extra_footer_meta' );
function tu_add_extra_footer_meta() {
if ( ! is_single() ) {
return;
}
?>
Your stuff here
<?php
}
That's not quite it.
It's outside the meta, and it only shows on single posts, not archives and blog pages.
Removing the "!" makes it show on archives and blog pages (like I want it) but still not inside the footer meta entry.
Unfortunately there's not a hook within the footer entry meta, however you should be able to style it so it looks the same.
Is there a specific reason you need it inside the meta div?
Okay. I found another solution.
I originally had all the options for the footer entry meta (categories, tags and comments) enabled in the customizer. I disabled them all and added them in myself in the "generate_after_entry_content"-hook instead and styled them so they looked exactly like the original meta. That way I could have it shown the way I wanted it.
Thanks for pointing me in the right direction. It's all good now :-)
Glad you found a solution :)