Written by on

How to Apply an Extension to a CPT Archive page in iThemes Builder

If you are using a Custom Post Type named say, portfolio in your iThemes Builder powered WordPress site, by default the CPT archive page, http://yoursite.com/portfolio/ will use Full Width layout (assuming the default Archives view is not deleted or modified) or which ever is the default layout (if there is no Archives view).

It is possible to have this CPT archive page use a specific layout by using builder_filter_current_layout filter. And by applying any extension (that Builder comes shipped with or your own custom one) to the layout we can have the CPT archive page’s content area laid out/styled in specific manner by click of a button.

Follow these steps:

1) Create a layout to be used by your CPT archive page. Apply your desired extension to this layout.

Manage Layouts and Views ‹ iThemes Builder Snippets — WordPress 2013-05-03 23-39-18

2) Note the ID of this layout. This is the number that’s at the end of URL when the layout is being edited.

3) To use builder_filter_current_layout filter to apply the above layout to archive page of a CPT named portfolio, add the following code at the end of child theme’s functions.php before closing PHP tag (if any):

// ===========================================
// = Assign a custom layout to Portfolio CPT =
// ===========================================

function custom_filter_portfolio_layout( $layout_id ) {
        if ( is_post_type_archive('portfolio') )
                        return '5183f570d6f84';

        return $layout_id;
}
add_filter( 'builder_filter_current_layout', 'custom_filter_portfolio_layout' );

where 5183f570d6f84 is the ID of layout that we wish to set to archive page of a CPT named portfolio.

Hints:

  1. Ensure that CPT’s has_archive is enabled
  2. Most extensions work with featured images attached to the entries. Therefore enable Thumbnail support for the CPT.

Sample screenshots:

CPT archive page using Portfolio extension

2013-05-03-23-51-19

CPT archive page using Magazine extension

2013-05-03-23-52-35

CPT archive page using Teasers Layout – Image Left extension

2013-05-04-00-06-32

Comments

Respond

×

Ends Today! Save 35% off BackupBuddy with coupon code BACKUPWP35