Site logo

Archived topic

Hook to Insert Notice on Specific CPT Category

6 replies · Started by Natalie on March 8, 2021

Viewing posts 1–7 of 7

Hi

I'm trying to add a short notice (generate_before_content) on a CPT (job_listing) for a specific category (Jobs for Youth or jobs_for-youth). I've tried something like this below with my job category but it's not working:

https://generatepress.com/forums/topic/header-sidebar-position/#post-287551

If I assign it to a specific post I can get it to work.

Thanks

Hi there,

how was the CPT template created ? If its not using a GP Template then it won't have the GP template hooks.

David

Right now it's using the default single page template. So if i was to assign all jobs to one of my existing layout elements it would take effect? Curious to know why, if I select a specific job, it will work using the default page template.

If its an Archive then you should see the following Display Rules:

CPT Name Category Archive -> Category Term

If its for a Single Post you should see:

CPT Name Category -> Category Term

David

It's single. I'm using a job listing plugin (WP Job Manager) that creates the category taxonomy out of the box but it's not visible when selecting Jobs. Oddly, other taxonomies I've created for the CPT on my own are visible, so I'm not able to select category. So I thought I might be able to use a little php to do so.

I decided to add another taxonomy for notices and it appeared in the dropdown.

All good...

Glad to hear you found a solution!

This archived topic is closed to new replies.