Hi,
Is there any way of assigning an header to a Post Category, rather than having to assign it to individual posts manually?
many thanks
Alex
Hi,
Is there any way of assigning an header to a Post Category, rather than having to assign it to individual posts manually?
many thanks
Alex
Hi Alex,
The method that I want to introduce is considered as customization and outside of our support scope. I will do my best to give you the data to work but the implementation will be on your shoulders.
Please kindly follow the steps below:
function custom_header_assignment( $match ) {
if ( is_single() ) {
if ( in_category( 'slug' ) ) {
$match = 1234; // the post ID for your header
}
}
return $match;
}
add_filter( 'cs_match_header_assignment', 'custom_header_assignment' );
slug
with the slug you wrote down in step 4.1234
with the header ID you wrote down in step 2.The given code checks to see if the current page is single (it is a post) and checks if it is in the category in question. Then assigns the Header ID to
cs_match_header_assignment
hook which is the one used to assign headers.
Thank you.
Thank you do much - worked a treat
As usual support over and beyond.
Stay safe
Alex
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.