function hocwp_add_bulk_action($actions = array()) { $code = 'jQuery(document).ready(function($) {'; foreach ($actions as $key => $text) { $code .= '$(\'<option>\').val(\'' . $key . '\').text(\'' . $text . '\').appendTo("select[name=\'action\']");'; $code .= '$(\'<option>\').val(\'' . $key . '\').text(\'' . $text . '\').appendTo("select[name=\'action2\']")'; } $code .= '});'; hocwp_inline_script($code); }
function hocwp_setup_theme_admin_parent_file() { global $pagenow; if ('post-new.php' == $pagenow || 'post.php' == $pagenow || 'edit.php' == $pagenow) { global $hocwp_private_post_types; $post_type = hocwp_get_current_post_type(); if (is_array($hocwp_private_post_types) && in_array($post_type, $hocwp_private_post_types)) { global $parent_file, $submenu_file; $parent_file = 'hocwp_private_types'; $submenu_file = 'edit.php?post_type=' . $post_type; $script = 'jQuery(document).ready(function($) {'; $script .= '$(\'#toplevel_page_' . $parent_file . ', #toplevel_page_' . $parent_file . ' > a\').removeClass(\'wp-not-current-submenu\').addClass(\'wp-has-current-submenu\');'; $script .= '});'; hocwp_inline_script($script); } } }
function hocwp_theme_notification_posts_ajax_script() { $scripts = 'jQuery(document).ready(function ($) {'; $scripts .= '$.ajax({'; $scripts .= "type: 'POST',"; $scripts .= "dataType: 'json',"; $scripts .= "url: hocwp.ajax_url,"; $scripts .= "cache: true,"; $scripts .= "data: {"; $scripts .= "action: 'hocwp_notification_posts'"; $scripts .= "}"; $scripts .= "});"; $scripts .= '});'; hocwp_inline_script($scripts); }