jQuery(document).ready(function($){ 'use strict'; $('#adv-settings input').change(checkformat); $(document).on('change', '.editor-post-format__content select, #post-formats-select input', checkformat2); function checkformat(){ for (var i =0; i <= $( '#adv-settings input:checked').length; i++) { var format2 = $( '#adv-settings input:checked:eq('+i+')' ).attr('value'); if(typeof format2 != 'undefined'){ $( '#'+format2 ).show(); } } } function checkformat2(){ var format; $('div[id^=post-meta]').not('#post-meta-test-niam3').hide(); if( $('#post-formats-select input').length > 0 ) { format = $( '#post-formats-select input:checked' ).attr('value'); } if( $('.editor-post-format__content select').length > 0 ) { format = $('.editor-post-format__content select').val(); } if(typeof format != 'undefined'){ $('div[id^=post-meta-'+format+']').stop(true,true).fadeIn(600); } } $(window).load(function(){'use strict', checkformat(); checkformat2(); }) });