This mostly affects people who are distributing their code in a theme or plugin, where the code will be run on WordPress installations in multiple languages.īasically the part of the $hook_suffix that is the parent menu page slug can be translated, so it will not match the string you are expecting. Note: if you are trying to use the $hook_suffix to check if you are on a submenu page, there is an important bug you should know about. wpregisterstyle() wp-includes/: Registers a CSS stylesheet. Función wpenqueuestyle () Un camino seguro para añadir/embeber un fichero con estilos CSS en una página generada con WordPress. For example we load sweetalert on your menu page and all sub-menu below your menu page.Īdd_action('admin_enqueue_scripts', 'add_admin_scripts') Log in to add feedback global $parent_file defined on admin-header.php line 27 ** Add Admin Pages **/Īdd_menu_page('Top Level Menu', 'Top Level Menu', 'manage_options', 'top-level-menu', 'your_callback_menu', 'dashicons-admin-tools', 10) Īdd_submenu_page('top-level-menu', 'Sub Menu', 'Sub Menu', 'manage_options', 'sub-menu', 'your_callback_submenu') Īdd_action('admin_menu', 'add_admin_pages') Load your scripts on your menu page and all sub-menu below your menu page. WP_Customize_Widgets::enqueue_scripts() wp-includes/class-wp-customize-widgets.phpĮnqueues scripts and styles for Customizer panel and export data to JavaScript. Outputs the iframe to display the media upload page. Generic Iframe header for use with Thickbox. Iframe_header() wp-admin/includes/template.php View all references do_action( 'admin_enqueue_scripts', $hook_suffix ) This should be used to enqueue scripts and styles only in the pages they are going to be used, and avoid adding script and styles to all admin dashboard unnecessarily. It provides a single parameter, $hook_suffix, that informs the current admin page. Despite the name, it is used for enqueuing both scripts and styles. Admin_enqueue_scripts is the proper hook to use when enqueuing scripts and styles that are meant to be used in the administration panel.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |