Support » Plugin: WP Job Manager » Use this functions code to add Jobs list (w/ count) link to top Admin bar!

  • I got tired of going to the dashboard to get to the Pending Jobs in admin so I made this to add it to the top Admin bar. I wanted to share, you’ll find it a time saver! Let me know if I did anything wrong, I followed the best practices I believe.

    Paste this in your themes child functions.php file:

    
    add_action( 'admin_bar_menu', 'admin_bar_item', 500 );
    function admin_bar_item ( WP_Admin_Bar $admin_bar ) {
        if ( ! current_user_can( 'manage_options' ) ) {
            return;
        }
    	
      $pending_jobs_count = WP_Job_Manager_Cache_Helper::get_listings_count();
     	
        $admin_bar->add_menu( array(
            'id'    => 'menu-id',
            'parent' => null,
            'group'  => null,
            'title' => '✓ Jobs <span style="display: inline;  padding: 1px 7px 1px 6px!important;  border-radius: 50%; color: #fff;   background-color: #d54e21;">'.esc_attr( $pending_jobs_count ).'</span>', 
            'href'  => admin_url('edit.php?post_type=job_listing'),
            'meta' => [
                'title' => __( 'View Jobs as Admin', 'textdomain' ),  //This title will show on hover
            ]
        ) );
    }
    

    enjoy

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter etheos

    (@etheos)

    In my original code I used the html equiv hex code for the check mark ✓ which is: #x2713; (add an & to the front of that) but the post even when using the code snippet here, removes it. Seems to work either way but you may want to replace the ✓ with the html.

    • This reply was modified 2 months, 2 weeks ago by etheos.
    Joe

    (@joewa1980)

    Nice idea, thanks for sharing!

    Thats so smooth and works like a charm !! Ok My issue…..cant see the buttons on the resumes. Job Dashboard => Job Applications => Click the number of applications and it doesnt show the buttons. Just the resumes are visible.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.