Include Sticky Post in Page Posts Count?

This is doable, and as I stated in a comment, you need to follow the following steps Get a count the amount of sticky posts. This can be done by simply counting get_option( ‘sticky_posts’ ) which holds the ID’s of the sticky posts in the form of an array You would also need to get … Read more

Enqueue Javascript Correctly for 3.5

Never de-register core-bundled scripts in the WP-Admin. You shouldn’t do it on the front end, either, unless you really, really know what you’re doing. But especially in the WP-Admin, just use the core-bundled scripts. Also, when you use core-bundled jQuery UI, WordPress already knows that jQuery is a dependency. Just change the first callback to … Read more

How can I set up multi language admin ui?

There are a couple of methods that this can be done without the overhead of plugins. Method 1 The first method involves hooking to the load_textdomain_mofile filter. (This must go into a separate plugin) function wpse31785_change_mofile( $mofile, $domain ) { if ( $domain == ‘default’ and get_current_user() == ‘riccardo’ ) return substr($mofile, 0, -8).’it_IT.mo’; return … Read more

Filters ‘request’ and ‘parse_query’ not firing in sites.php nor link-manager.php

I managed to order the link-manager.php by a custom column using this: /* * Sort links using the custom column link_image */ function sort_on_field(&$objects, $on, $order=”ASC”) { $comparer = ($order === ‘DESC’) ? “return -strcmp(\$a->{$on},\$b->{$on});” : “return strcmp(\$a->{$on},\$b->{$on});”; usort($objects, create_function(‘$a,$b’, $comparer)); } function brsfl_link_manager_order($links) { global $current_screen; if($current_screen->id == ‘link-manager’ && $_GET[‘orderby’] == ‘link_image’) { … Read more

Plugin Development: WordPress processes twice on post update. How to skip process on the first?

@Steve Functions hook to save_post are always called twice, WordPress call functions hooked to save_post twice because: first time it saves the post revision. second time it saves the actual post. NOTE: If you have disabled post revisions using define(‘WP_POST_REVISIONS’, false); then the save_post hook will be fired only once when the actual post will … Read more

Removing admin bar from wordpress dashboard

if (!function_exists(‘disableAdminBar’)) { function disableAdminBar(){ remove_action( ‘admin_footer’, ‘wp_admin_bar_render’, 1000 ); function remove_admin_bar_style_backend() { echo ‘<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>’; } add_filter(‘admin_head’,’remove_admin_bar_style_backend’); } } add_filter(‘admin_head’,’remove_admin_bar_style_backend’); Source: http://wp.tutsplus.com/tutorials/how-to-disable-the-admin-bar-in-wordpress-3-3/ OR, for both front and back end… if (!function_exists(‘disableAdminBar’)) { function disableAdminBar(){ remove_action( ‘admin_footer’, ‘wp_admin_bar_render’, 1000 ); // for the admin page remove_action( ‘wp_footer’, ‘wp_admin_bar_render’, … Read more

Increment Page Order As Pages Are Created

The following is a possible solution, but needs some testing to confirm it is viable. It runs only if menu_order == 0 and if it’s not an auto-draft or revision being saved add_action( ‘save_post’, ‘incremental_save_wpse_113767’, 10, 2 ); function incremental_save_wpse_113767( $post_id, $post_object ) { if( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; if( defined( ‘DOING_AJAX’ … Read more

how to create my own edit.php admin page code or template for my custom post type

When you register the CPT set show_ui to false. For example: $args = array( ‘labels’ => $labels, ‘public’ => true, ‘publicly_queryable’ => true, ‘show_ui’ => false, // <– here ‘show_in_menu’ => true, ‘query_var’ => true, ‘rewrite’ => array( ‘slug’ => ‘book’ ), ‘capability_type’ => ‘post’, ‘has_archive’ => true, ‘hierarchical’ => false, ‘menu_position’ => null, ‘supports’ … Read more