# OceanWP: Full-Width Layout for Selected Post Types

> Makes the post types you list use OceanWP's full-width layout without a sidebar, for shops, portfolios or courses.

- Type: PHP
- Runs: Frontend only
- Category: [Page Builders & Themes](https://wpide.com/library/category/page-builders/)
- Tags: oceanwp, layout, sidebar
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/oceanwp-full-width-post-types/

## Code

```php
// Post types that should be full width.
$wpide_ocean_full_types = array( 'product', 'portfolio' );

add_filter( 'ocean_post_layout_class', function ( $class ) use ( $wpide_ocean_full_types ) {
    if ( is_singular( $wpide_ocean_full_types ) || is_post_type_archive( $wpide_ocean_full_types ) ) {
        return 'full-width';
    }

    return $class;
} );
```

## Notes

OceanWP layout values: full-width, full-screen, left-sidebar, right-sidebar, both-sidebars.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "OceanWP: Full-Width Layout for Selected Post Types" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
