Add ‘Right Now’ widget to custom dashboard

I’ve got to know it in Make WordPress UI. The plugin Dashboard uses a very interesting technique: add_action( ‘load-index.php’, array( $this , ‘override_dashboard’ ) ); public function override_dashboard() { if( !isset( $_GET[‘page’] || ‘custom-dash’ != $_GET[‘page’] ) return; if ( get_current_screen()->in_admin( ‘site’ ) ) { require dirname( __FILE__ ) . ‘/dashboard-override.php’; exit; } } And … Read more

How to change “Dashboard” text in wordpress

If you put the code below on your functions you should be able to filter the global $title easily on the admin_head action. <?php add_action( ‘admin_head’, ‘q167372_dash_name’ ); function q167372_dash_name( ){ if ( $GLOBALS[‘pagenow’] != ‘index.php’ ){ return; } $GLOBALS[‘title’] = __( ‘Your new Title’ ); }

Allow comments without approval for custom content type

Yes, it is possible using wp_insert_comment hook. To approve comments automatically for custom post types you can use something similar to this: //hook to do stuff with comments add_action( ‘wp_insert_comment’, ‘approve_comment’, 99, 2 ); function approve_comment($comment_id, $comment_object) { //get id of the post that was commented $post_id = $comment_object->comment_post_ID; //approve comment for “post” type if( … Read more

WordPress development using Docker – how to share directories? [closed]

I wrote up a short tutorial in this other answer which goes into a little more detail, but I think you want to use docker-compose to define any directories (volumes) that you want to share between your local environment and the container environment. There may be a way to do this directly with Docker, but … Read more

Add custom column to Users admin panel with Types user custom fields?

To fix the error, you can do something like this: function new_modify_user_table_row( $val, $column_name, $user_id ) { $user = get_userdata( $user_id ); switch ($column_name) { case ‘les-non-specialistes’ : return get_the_author_meta( ‘les-non-specialistes’, $user_id ); break; case ‘specialistes’ : return ”; break; default: } return $val; //<– Changed } Regarding the date, which date are you looking … Read more

Only append custom classes to nav menu items

Yes, they’re stored as metadata ‘_menu_item_classes’ for each menu item so eg (updated to use separate function) function custom_wp_nav_menu_css_class( $classes, $item, $args, $depth ) { $whitelist = array( //List of allowed menu classes ‘current_page_item’, ‘current_page_parent’, ‘current_page_ancestor’, ‘first’, ‘last’, ‘vertical’, ‘horizontal’ ); // Note array containing empty entry always created for menu item meta so filter … Read more

How to change URL Custom Page?

You’re using the reserved public query variable name as your custom one. It can e.g. affect the canonical redirect by setting page_id and name for a different page. Change it to something else to avoid possible name collision, like kenan_video_slug: add_rewrite_rule( ‘^watch/([^/]*)$’, ‘index.php?pagename=watch&kenan_video_slug=$matches[1]’, ‘top’ ); Note that your rewrite will override the content pagination for … Read more