Show admin bar to editors with Buddypres

Please see https://codex.wordpress.org/Function_Reference/show_admin_bar. With newer version of WordPress you may need to use the following which will leave the Toolbar available in the Dashboard but hide it on all front facing pages. So instead of show_admin_bar(true); you can use add_filter(‘show_admin_bar’, ‘__return_true’);

Add view to admin menu to filter for specific criteria ( If post is child of specific Parent )

You can “load the pages” via the pre_get_posts action, like so: add_action( ‘pre_get_posts’, ‘my_admin_pre_get_posts’ ); function my_admin_pre_get_posts( $q ) { // Check whether the filter was clicked. if ( isset( $_GET[‘post_parent’] ) ) { $screen = is_admin() ? get_current_screen() : null; // And that it’s the edit pages page. if ( $screen && ‘edit-page’ === … Read more

Admin Bar Acting Up

Try adding this code to your theme functions.php file: if ( is_user_logged_in() ) { show_admin_bar( true ); } If this doesn’t work, try logging into your site using a new “Incognito” window and see if the Admin Bar shows up on the front end. If it does, you probably need to clear the cookies for … Read more

Adding orderby url parameter to main CPT admin menu link

You can set $_GET directly inside your pre_get_posts action to get the UI to pickup that change: function wpd_test_pre_get( $query ) { // put whatever conditions to target your cpt here if( is_admin() && $query->is_main_query() ){ // modify query $query->set(‘orderby’, ‘title’); $query->set(‘order’, ‘asc’); // set $_GET vars $_GET[‘orderby’] = ‘title’; $_GET[‘order’] = ‘asc’; } } … Read more

require/include php file in add_menu()

You can turn on output buffering, include (and evaluate) the PHP file, and save the output (of the evaluated code) in a variable, like so: ob_start(); include ‘docs/row_layouts.php’; $html = ob_get_clean(); Then just use ‘html’ => $html in the meta array when you call the $admin_bar->add_menu(). Or if you don’t need to evaluate any PHP … Read more