• Hello,

    I found this article on oceanWP docs and was able to change the layout for a custom post type on my site. But I need to make few more custom post types to full width.

    The code I found was:

    function my_post_layout_class( $class ) {
    
    	// Alter your layout
    	if ( is_singular( 'sfwd-topic' ) ) {
    		$class = 'full-width';
    	}
    
    	// Return correct class
    	return $class;
    
    }
    add_filter( 'ocean_post_layout_class', 'my_post_layout_class', 20 );

    You see I edited “sfwd-topic” post type. But I also wanna add “sfwd-lesson” and “sfwd-quiz” …. Can anyone tweak the snippet for me? I haven’t learnt coding yet. It would be a great help.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author oceanwp

    (@oceanwp)

    Hello, sure thing ??
    Try this code:

    function my_post_layout_class( $class ) {
    
    	// Alter your layout
    	if ( is_singular( 'sfwd-topic' )
    		|| is_singular( 'sfwd-lesson' )
    		|| is_singular( 'sfwd-quiz' ) ) {
    		$class = 'full-width';
    	}
    
    	// Return correct class
    	return $class;
    
    }
    add_filter( 'ocean_post_layout_class', 'my_post_layout_class', 20 );
    Thread Starter Yanur Islam Piash

    (@yipiash)

    Thank you again ??

    Theme Author oceanwp

    (@oceanwp)

    You’re welcome ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Altering Layouts for multiple Custom Post Types’ is closed to new replies.