• Resolved greatness0013

    (@greatness0013)


    Would it be possible to add the button to the admin bar in addition to the dashboard? If so, how would I accomplish that?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author webheadcoder

    (@webheadllc)

    Glad you asked! I keep wanting to add that to the plugin, but was too lazy to add it without it being requested. This will be in the next version of the plugin.

    If you want it now (because I’m not sure when the next version will be out), you’ll need to modify the plugin code. Please do so only if you feel comfortable with modifying code. If anything goes wrong with your site, you can delete the plugin and start over. Make sure you have some kind of FTP access so you can delete the plugin when your site is down.

    In version 1.3, in the clear-cache-for-widgets.php file, on line 345, look for

    if ( isset( $_POST['ccfm'] ) ) {

    Replace it with
    if ( isset( $_REQUEST['ccfm'] ) ) {

    Then add the following in the same file at the bottom on a new line:

    
    /**
     * add a link to the WP Toolbar
     */
    function ccfm_toolbar_link( $wp_admin_bar ) {
        $url = add_query_arg( '_wpnonce', wp_create_nonce( 'ccfm' ), admin_url() . '?ccfm=1' );
        $args = array(
            'id' => 'ccfm-link',
            'title' => 'Clear Cache For Me', 
            'href' => $url, 
            'meta' => array(
                'title' => 'Clear Cache For Me'
            )
        );
        $wp_admin_bar->add_node( $args );
    }
    add_action( 'admin_bar_menu', 'ccfm_toolbar_link', 999 );
    

    Again, modify the code at your own risk. Make sure you have a way to delete the files if you can’t access your WordPress dashboard.

    Thread Starter greatness0013

    (@greatness0013)

    Thanks for this. I’ll report back with the results!

    Plugin Author webheadcoder

    (@webheadllc)

    Got to this faster than I thought. This has been added in v1.4.

    Thread Starter greatness0013

    (@greatness0013)

    Thank you for this! My IT hadn’t gotten to it yet for me to report results.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Button in Admin Bar’ is closed to new replies.