Archived topic
Trying to Add Custom Meta to Blog and Archive Listings
3 replies · Started by Samuel on November 13, 2017
I'm running into a problem adding a custom entry-meta content. Here's the situation:
I only want to list my own custom taxonomy rather than Wordpress categories.
I added code to output the list of terms associated with a post and registered the generate_after_entry_content hook.
Here's my two problems:
On the blog page it doesn't seem to be running that hook at all (I don't know if this is normal and I should be using another hook instead?). The result is that I see the categories listed at the end of the entry-summary but I don't see my custom taxonomy terms listed for the post. However, on archive pages it is running the hook.
My second problem is that I only want to display my custom taxonomy not the Wordpress categories. If I uncheck the box to show Wordpress categories then I get nothing on the blog page listing. On the archive page listing, I lose the categories (which I want) but I also lose my custom taxonomy that's being input via the hook.
What's the best way to solve this?
Can you try using the generate_after_content hook instead?
Thank you, I found the problem. When I disable post categories it turns out GP just hides the html using css rather than not generating category information. Because I had an entry-meta class on my custom taxonomy it was getting hidden by the display: none. I'm not sure how I missed that.
Ah yes - it removes the elements, but can't remove the empty container so it just hides it.
You can give it a second class like custom and then do this:
.entry-meta.custom {
display: block;
}