//CHECK WHEN REACT RENDER IS COMPLETE
var CheckRenderId;
function checkRender() {
    if(!jQuery('.editor-page-attributes__template').size()) {
        
        CheckRenderId = requestAnimationFrame(checkRender);

    }else{

        cancelAnimationFrame(CheckRenderId);     

        if(jQuery('.editor-page-attributes__template select option:selected').val() == 'template-portfolio.php'){
            jQuery('#fourseasons-category-selector').css('display','block');
        }else{
            jQuery('#fourseasons-category-selector').css('display','none');
        }
        

    }
};
checkRender();




//ON TEMPLATE CHANGE
jQuery(document).on('change','.editor-page-attributes__template select', function(){

    if(jQuery('option:selected',this).val() == 'template-portfolio.php'){
        jQuery('#fourseasons-category-selector').css('display','block');    
    }else{
        jQuery('#fourseasons-category-selector').css('display','none');    
    }

});