From 442f8f76a24e408ba81597c7b86a1263bc096917 Mon Sep 17 00:00:00 2001 From: RtlTheme Date: Mon, 23 Feb 2015 19:47:34 +0330 Subject: [PATCH] Create checktype.js --- js/checktype.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 js/checktype.js diff --git a/js/checktype.js b/js/checktype.js new file mode 100644 index 0000000..401f187 --- /dev/null +++ b/js/checktype.js @@ -0,0 +1,25 @@ +/** + * Display post format meta boxes as needed + * Change meta boxes id to metabox-post-FORMAT +**/ + +jQuery(document).ready(function($){ + + $('#post-formats-select input').change(checkFormat); + $('.wp-post-format-ui .post-format-options > a').click(checkFormat); + + function checkFormat(){ + var format = $('#post-formats-select input:checked').attr('value'); + if( typeof format != 'undefined'){ + $('#post-body div[id^=metabox-post-]').hide(); + $('#post-body #metabox-post-'+format+'').stop(true,true).fadeIn(500); + } + } + + $(window).load( function(){ + checkFormat(); + }) + +}); + +