body_class hook for admin pages
Admin pages don’t use the body_class filter, use the admin_body_class filter to add classes to admin body tag instead. Note that $classes in that case is a string, not an array.
Admin pages don’t use the body_class filter, use the admin_body_class filter to add classes to admin body tag instead. Note that $classes in that case is a string, not an array.
Give the anchor a class of thickbox and make sure that the thickbox script is enqueued on your admin page using add_thickbox add_thickbox(); and <a href=”https://wordpress.stackexchange.com/questions/48514/your url” class=”thickbox”>click here</a> You can see what add_thickbox does here: http://hitchhackerguide.com/2011/02/11/add_thickbox/
Hi @Tom, If I understand your question correctly you don’t so much need to know how to add a link to the menu (it seems you already know that) but instead need to learn how to get your link to redirect correctly, right? Redirecting to an External URL from an Admin Menu Item If so … Read more
Try this code for adding scripts to the edit pages of your portfolio custom post type. add_action( ‘admin_print_scripts-post-new.php’, ‘portfolio_admin_script’, 11 ); add_action( ‘admin_print_scripts-post.php’, ‘portfolio_admin_script’, 11 ); function portfolio_admin_script() { global $post_type; if( ‘portfolio’ == $post_type ) wp_enqueue_script( ‘portfolio-admin-script’, get_stylesheet_directory_uri() . ‘/admin.js’ ); }
You can use get_current_screen to determine this. $screen = get_current_screen(); if ( $screen->parent_base == ‘edit’ ) { echo ‘edit screen’; } I don’t know if I exactly would say this is always better, it depends on what’s needed, but it’s probably the way I’d do it. The big benefit with this method is that you … Read more
here is a function that i have: /** * is_edit_page * function to check if the current page is a post edit page * * @author Ohad Raz <[email protected]> * * @param string $new_edit what page to check for accepts new – new post page ,edit – edit post page, null for either * @return … Read more
Here’s a quick and dirty way to get what you want. Background WordPress stores admin menu sections in a global array called $menu. To add a separator you add an element to the $menu array using an index that is between the indexes of the options that you want to separate. Using the add_admin_menu_separator() function … Read more
I thought that check_admin_referer checked the nonce (it does call wp_verify_nonce, and the referring url. After digging into the core code I realised that it did not do this. Thinking it was a bug I reported it, and Ryan Boren replied with the following: Actually, if the nonce is valid the referrer should not be … Read more
Hi @BinaryBit: It’s no wonder you are a bit frustrated; the admin menu is one of the most obtuse and frustrating implementations through WordPress core. Honestly, I don’t know what they were thinking when they designed it that way. @EAMann did an excellent job of explaining how the admin menus work in WordPress (I wish … Read more
Ok, Here is the code to allow your users to add phone numbers. Paste this full code in functions.php file. This will add new field on user profile for “Phone Number” and add a column user table on WordPress admin for phone. function new_contact_methods( $contactmethods ) { $contactmethods[‘phone’] = ‘Phone Number’; return $contactmethods; } add_filter( … Read more