Disable Auto-Expanding Menu in WordPress Admin Menus

I see two options here – override the CSS, or remove the “active” classes with JavaScript (sadly there is no action/filter that we can do this server-side) – I opted for the JS approach, it’s cleaner, leaner and meaner: function wpse_227037_remove_menu_classes() { echo ‘<script>jQuery( “.wp-has-current-submenu.wp-menu-open” ).removeClass( “wp-has-current-submenu wp-menu-open” ).addClass( “wp-not-current-submenu” );</script>’; } add_action( ‘adminmenu’, ‘wpse_227037_remove_menu_classes’ … Read more

how to add a comment button to be displayed only for the posts in the home page [closed]

In the template part used in the loop on your home page, something like this should get you started. Someplace after the_content(); or the_excerpt(), depending on what you’re using. <?php if ( is_home() ) { ?> <a class=”button” href=”<?php echo esc_url( get_permalink() );?>#comments”> Comment Link Text </a> } ?> You can make it look like … Read more

What is the replacement for rich_edit_exists()?

This is stored in the user meta table under the rich_editing meta key for each user. You could one of these (untested): 1) Add it for your specific users, e.g. via `add_user_meta( $user_id, ‘rich_editing’, ‘true’, true );` 2) Within the wp_default_editor() function, that determines the default editor, the user_can_richedit() function is applied. It checks for … Read more

Add post type pages with plugin

You can’t without hooking a filter to recognise the files in your plugin BUT you can hook into the template_include filter and register your own file e.g. add_filter(‘template_include’, ‘my_function_name’); function my_function_name( $template ) { if( is_post_type_archive( ‘post_type’ ) ){ $template = dirname( __FILE__ ) . ‘/templates/archive-post_type.php’; } if( is_singular( ‘post_type’ ) ){ $template = dirname( … Read more