Assigning a header to post categories

Hello,

Is there built in functionality/support for assigning a header to a specific post category?

There was this old post that gave a code solution but I wanted to see if something in the actual Pro functionality had since been provided.

Thanks!

Hi @jasonixr,

Thanks for reaching out.

Regretfully, currently there no such option to change the featured image size.
In the near future, you can have full control over blog layouts, posts, index pages, and archive pages using Layout Builder.
More details about the Layout Builder was posted in our June Status Report here: https://theme.co/content/status-report-june-02-2020

Alternatively, the solution provided in the reference thread can be used. Just remember that we don’t offer any support to the custom code and issues due to the custom codes.

Thanks

My question had nothing to do with changing the post layouts or featured image sizes.

I’m asking if there is a way to assign a header to a post category. Headers can be manually assigned to individual posts or to all posts but I’m asking if there is a way to assign a header via the post category so my client doesn’t have to manually go in and assign the appropriate header via the Header tool each time they create a new blog post (we have different headers depending on the language of the post).

Hello @jasonixr

Unfortunately, assigning headers to the category or archive pages aren’t possible. But you can check and implement the workaround here Header assigned to a Post category. Basically, it’s just about the filter cs_match_header_assignment. And you can utilize that filter to control how the header is displayed. The code provided in that thread is just a guide, you shouldn’t add/use it as is, and you still need to change it to make it work to your preferred setup. Example

function custom_header_assignment( $match ) {
  if ( is_category() ) {
      $match = 1234; // the post ID for your header
  }
  return $match;
}
add_filter( 'cs_match_header_assignment', 'custom_header_assignment' );

If you just follow what’s provided in that thread then it will not really work, please keep in mind that we don’t maintain the code. What was provided is just the backbone, the rest is up to you.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.