Using tabs in admin widgets [closed]

The problem is that you’re not using unique IDs (#tabs, #tabs-1 …), because widgets have multiple instances (the same IDs are used by the instance form the “Available Widgets” area). So just prepend or append the widget instance ID to your identifiers to make them unique: … <div id=”tabs-<?php echo $this->id; ?>”> <ul> <li><a href=”#tabs-<?php … Read more

Add a special filter link to All Posts in admin

First of all in your image you can see that WordPress lets you filter the posts by category, just bellow the what you have added to the image, But if you want to know how you can add your own link to the filter you can use the views_edit-post filter hook ex: add_action(‘pre_get_posts’, ‘query_add_filter’ ); … Read more

Add link on the top menu of the post table?

They are filtered via the views_[screen-id] filter. The screen-id of the edit post page is edit-post, so you can modify the links like this: add_action( ‘views_edit-post’, ‘wpse17484_views_edit_post’ ); function wpse17484_views_edit_post( $views ) { $views[‘wpse17484’] = ‘<a href=”https://wordpress.stackexchange.com/questions/17484/my-url”>My action</a>’; return $views; } You can see the code that generates the post views in WP_Posts_List_Table::get_views().

Customize Admin Users Screen based on Role

Manage Columns It’s pretty straight forward using the manage_{post-type-name}_columns filter: Just switch per $capability and unset what you don’t need in the $post_columns array. function wpse19435_manage_columns( $posts_columns ) { // First role: add a column – take a look at the second function if ( current_user_can( $capability_admin ) ) { $posts_columns[‘some_column_name’] = _x( ‘Whatever’, ‘column … Read more

Only allow new subpages to be created

Code based in Bainternet’s answer to this question: Make Categories and Tags required in admin See code comments. add_action( ‘admin_head-post-new.php’, ‘wpse_59770_publish_admin_hook’ ); add_action( ‘admin_head-post.php’, ‘wpse_59770_publish_admin_hook’ ); add_action( ‘wp_ajax_wpse_59770_pre_submit_validation’, ‘wpse_59770_ajax_pre_submit_validation’ ); function wpse_59770_publish_admin_hook() { global $current_screen; if( ‘page’ != $current_screen->post_type ) return; ?> <script language=”javascript” type=”text/javascript”> jQuery(document).ready(function() { jQuery(‘#publish’).click(function() { var form_data = jQuery(‘#parent_id’).val(); form_data = … Read more

Blocking Administrative Access to Authors and Subcribers?

Create a functionality plugin and use this if you want to completely block the access to the Admin panel: /** * Hide the admin bar in the front end */ add_filter(‘show_admin_bar’, ‘__return_false’); /** * Redirects Authors and Subscribers to the site front page using: get_home_url() */ add_action(‘admin_init’,’block_users_wpse_53675′); function block_users_wpse_53675() { if( !current_user_can( ‘delete_pages’ ) ) … Read more