jQuery(document).ready(function( $ ) {
    function blogPostXMetaboxIsActiveClassToggle( $selector ) {
        var layoutSectionContainer = $( $selector )
        if( layoutSectionContainer.length > 0 ) {
            layoutSectionContainer.on('click', '.layout-item', function(){
                var _this = $(this)
                _this.addClass('isactive').siblings().removeClass('isactive')
            })
        }
    }

    blogPostXMetaboxIsActiveClassToggle( '.sidebar-section' );   // sidebar layouts ( posts and page )
    blogPostXMetaboxIsActiveClassToggle( '.single-layouts-section' );    // single posts layouts ( posts )
    blogPostXMetaboxIsActiveClassToggle( '.taxonomy-sidebar-layouts-wrap' ); // sidebar layouts ( categories & tags )
    blogPostXMetaboxIsActiveClassToggle( '.taxonomy-archive-layouts-wrap' ); // archive layouts ( categories & tags )
})