Site logo

Archived topic

Specific content padding for CPT posts

1 reply · Started by Jesus Manuel on February 18, 2021

Viewing posts 1–2 of 2

Hello, I have succesfully set the general content padding in Appearance > Customize > Layout > Container, but I have a Custom Post Type and I would need a specific padding for the CPT single entries only. I had thought about adding some specific wrappers for the CPT and using them to create a specific CSS rule, but I wonder if there is a cleaner way to achieve it. Thanks.

Hi there,

You can use the option_generate_blog_settings and other filters to change the layout etc for specific pages/posts/post types.
https://docs.generatepress.com/article/option_generate_blog_settings/

Example:

add_filter( 'option_generate_blog_settings', 'lh_custom_search_results_page_settings' );
function lh_custom_search_results_page_settings( $options ) {
 if ( is_single() && get_post_type( get_the_ID() ) == 'slug_custom_post_type' ) {
      return $options;
    }
}
This archived topic is closed to new replies.