Posts Tagged: jquery


4
Nov 11

WP Options Pages make ugly code, this class makes it pretty

Few things I hate more about doing a WP plugin than coding up an options page. It seems no matter how many times I do it, it’s always drudgery. It sets off my procrastination instinct like nothing else, and it makes what could have otherwise been clean and simple code look gnarly.

No More!!

I put together this class to make it pretty and easy. so now it’s as simple as below:


$optionsPage = new WPAdminOptionsPage($getPageParam, $parentMenu, $menuTitle, $pageTitle, $minAccessLevel, $callback, $topLevel=FALSE);

$optionspage->add_script(array('jquery-ui-core'));
 $optionspage->add_script(array('jquery-ui-tabs'));
 $optionspage->add_script(array('jquery-ui-sortable'));
 $optionspage->add_script(array('custom_js_script_handle', 'http://url_to_scriptfile', array('handles, of, script, dependencies')));

$optionspage->add_style(array('stylesheet_handle', 'http://url_to_stylesheet'));
Enhanced by Zemanta