Remove date and category filters when editing custom post types

To remove the dates: function my_remove_date_filter( $months ) { global $typenow; // use this to restrict it to a particular post type if ( $typenow == ‘post’ ) { return array(); // return an empty array } return $months; // otherwise return the original for other post types } add_filter(‘months_dropdown_results’, ‘my_remove_date_filter’); To remove categories: function … Read more

Add column to pages table

Also an tutorial with an solution for page and post to add thumbnail in a column: http://wpengineer.com/1960/display-post-thumbnail-post-page-overview/ Change the content from thumbnail to your content and remove the hooks for post: // for posts // add_filter( ‘manage_posts_columns’, ‘fb_AddThumbColumn’ ); // add_action( ‘manage_posts_custom_column’, ‘fb_AddThumbValue’, 10, 2 ); // for pages add_filter( ‘manage_pages_columns’, ‘fb_AddThumbColumn’ ); add_action( ‘manage_pages_custom_column’, … Read more

Create a clickable name in WP_List_Table for Plugin Admin

The WP_List_Table class ultimately uses the single_row_columns method to output each table cell. If we look at that method, we’ll see this part: … elseif ( method_exists( $this, ‘column_’ . $column_name ) ) { echo “<td $attributes>”; echo call_user_func( array( &$this, ‘column_’ . $column_name ), $item ); echo “</td>”; } … Add a method to … Read more

How to disable or hide “collapse menu”

Here is a simple css display: none function, it just adds some css in the html, if there are more stuff that you want to hide i recommend you to add a new css-file with the function admin_enqueue_scripts function wpse_remove_collapse() { echo ‘<style type=”text/css”>#collapse-menu { display: none; visibility: hidden; }</style>’; } add_action(‘admin_head’, ‘wpse_remove_collapse’);

WordPress in sub directory wp-admin problem

I think you are missing some rules in your WP .htaccess file. I show mine below. Notice the rules for wp-admin, add them to your file: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /subcataloged/cliens-wp/ RewriteRule ^index\.php$ – [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond … Read more

How do I add to the list table a filter?

You can use views_edit-post hook to do so. It is a possible variation of views_{$this->screen->id} and resides in class-wp-list-table.php. add_filter(‘views_edit-post’, ‘my_post_views’ ); function my_post_views( $views ){ $views[‘html_class_name_for_li’] = ‘the html’; // ex: <a href=”#”>something (11)</a> return $views; }

How can I delete all inactive widgets?

You should do it with after_setup_theme action: function remove_inactive_widgets() { $sidebars_widgets = get_option( ‘sidebars_widgets’ ); $sidebars_widgets[‘wp_inactive_widgets’] = array(); update_option( ‘sidebars_widgets’, $sidebars_widgets ); } add_action( ‘after_setup_theme’, ‘remove_inactive_widgets’ );

How to set custom editor style when editing the homepage?

If I understand you correctly, you want a custom editor style when editing the homepage? You can check if you’re currently editing the homepage by comparing the post ID to the ID in the page_on_front option, like this: function homepage_editor_styles() { global $post_ID, $post_type; if ( empty ( $post_ID ) || ‘page’ !== $post_type ) … Read more