With WP 3.4 customizer, while using postMessage & working within your JS for one option, can you retrieve current value for another option?

What you could do is the following : // ———————————————————- // Primary Typograpy // ———————————————————- var current; /* Primary Typography – Size */ wp.customize(‘typography_primary_size’, function( value ) { current.size = value; value.bind(function(size) { $(‘h1, h2, h2, h4, h5, h6’).css(‘font-size’, size); }); }); /* Primary Typography – Face */ wp.customize(‘typography_primary_face’, function( value ) { current.face = … Read more

Getting the different post statuses + count like in edit.php, in a custom submenu page

The class used in edit.php is an extension of the WP_List_Table: WP_Posts_List_Table. See wp-admin/includes/class-wp-posts-list-table.php. And here you find a call to wp_count_posts( $type=”post”, $perm = ” ). The first parameter is for the post type, the second can be empty or readable. If it is readable and the current user has no permission to see … Read more

remove_action with profile_personal_options

Sometimes you need to get a little creative when customizing the WordPress admin area. It’s often possible to do it without CSS, but it isn’t always straightforward: understanding what’s happening on the source files and digging through the many functions called in the ifs and elses is a must. Here’s something slightly hacky I came … Read more

What does $_registered_pages do?

$_registered_pages is a temporary container for all registered admin menu pages. It is filled in add_menu_page() and add_submenu_page() and used used later in user_can_access_admin_page(). The leading underscore indicates you should not use it for anything. It is private and might change its name any time without warning. So do not use it in your own … Read more

get_template_part in admin

Yes, get_template_part() does work on Admin pages. Here is how I tested: Add this to functions.php theme (or child theme) file: add_action( ‘admin_menu’, ‘wpse_99662_register_admin_test_page’ ); function wpse_99662_register_admin_test_page() { add_menu_page( ‘Admin Test Page’, ‘Admin Test Page’, ‘manage_options’, ‘admin_test_page’, ‘wpse_99662_admin_test_page’ ); } function wpse_99662_admin_test_page() { echo ‘<h2>Admin Test Page</h2>’; get_template_part( ‘admin’, ‘test’ ); } The admin-test.php file … Read more

Add tabbed menu to admin page

if you don’t like this method. maybe you would like the follow code: you can try to put the follow code in your functions.php file- // Theme options /* get options & set default options */ if( !function_exists(‘share3h_theme_get_options’) ) : function share3h_theme_get_options($option){ $share3h_theme_options = get_option(‘share3h_theme_options’); if( !$share3h_theme_options || array_key_exists($option, $share3h_theme_options) ) : $share3h_theme_default_options = array( … Read more

Display site admin profile fields in header.php

Ok I figured a way to do it. If anyone else is interested, here’s the code. It first gets the user id of the admin of the blog, and then it uses the id to pull the meta from the profile fields. For one field — <?php $thisblog = $current_blog->blog_id; $user_id_from_email = get_user_id_from_string( get_blog_option($thisblog, ‘admin_email’)); … Read more