• Resolved Generosus

    (@generosus)


    Good Day,

    We enjoy using your plugin and its features — especially the External Tools feature.

    Based on the above, can you guys kindly add the following website performance checkers to your plugin’s External Tools feature?

    Speedvitals (TTFB Test)
    WebPage Test (Waterfall Test)

    Until then, we developed the code snippet provided below for the same purpose.

    Results: Before and After.

    Thank you!

    ————

    function add_submenu_links ($wp_admin_bar) {
    if ( ! is_admin() ) {
    $wp_admin_bar->add_node( array(
    'parent' => 'rank-math-third-party',
    'id' => 'speedvitals',
    'title' => 'SpeedVitals',
    'href' => 'https://speedvitals.com/ttfb-test',
    'meta' => false
    ));

    $wp_admin_bar->add_node( array(
    'parent' => 'rank-math-third-party',
    'id' => 'webpagetest',
    'title' => 'WebPageTest',
    'href' => 'https://www.webpagetest.org/',
    'meta' => false
    ));
    }
    }
    add_action( 'admin_bar_menu', 'add_submenu_links',999 );
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Generosus

    (@generosus)

    Improved Code Snippet:

    This code snippet adds new submenu links to Rank Math’s External Tools link on frontend. Feel free to use your favorite URL (i.e. ‘href’).

    // Add Submenu Links to Rank Math External Tools on Frontend
    function add_submenu_links ($wp_admin_bar) {

    // Get the current URL
    $currentURL = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

    if ( ! is_admin() ) {

    $wp_admin_bar->add_node( array(
    'parent' => 'rank-math-third-party',
    'id' => 'http-header-check',
    'title' => esc_html__( 'HTTP Header Check', 'rank-math' ),
    'href' => 'https://www.atatus.com/tools/security-header#url=' . $currentURL,
    'meta' => [ 'title' => esc_html__( 'HTTP Header Check', 'rank-math' ) ],
    ));

    $wp_admin_bar->add_node( array(
    'parent' => 'rank-math-third-party',
    'id' => 'speedvitals',
    'title' => esc_html__( 'SpeedVitals', 'rank-math' ),
    'href' => 'https://speedvitals.com/ttfb-test/?url=' . $currentURL,
    'meta' => [ 'title' => esc_html__( 'SpeedVitals', 'rank-math' ) ],

    ));

    $wp_admin_bar->add_node( array(
    'parent' => 'rank-math-third-party',
    'id' => 'webpagetest',
    'title' => esc_html__( 'WebPageTest', 'rank-math' ),
    'href' => 'https://www.webpagetest.org/?url=' . $currentURL,
    'meta' => [ 'title' => esc_html__( 'WebPageTest', 'rank-math' ) ],
    ));
    }
    }
    add_action( 'admin_bar_menu', 'add_submenu_links',999 );

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @generosus,
    ?
    Thank you for contacting Rank Math support.
    ?
    We have added your request to our internal suggestions list. If your suggestions are something that we’re able to introduce, we’ll be sure to let you know.
    ?
    Please do not hesitate to let us know if you need our assistance with anything else.

    Thread Starter Generosus

    (@generosus)

    Updated Code Snippet: (Opens External Tools in New Tab)

    // Add Submenu Links to Rank Math External Tools on Front End
    function add_submenu_links ($wp_admin_bar) {

    // Get the current URL
    $currentURL = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

    if ( ! is_admin() ) {

    $wp_admin_bar->add_node( array(
    'parent' => 'rank-math-third-party',
    'id' => 'http-header-check',
    'title' => esc_html__( 'HTTP Header Check', 'rank-math' ),
    'target' => esc_html__( '_blank', 'rank-math' ),
    'href' => 'https://www.atatus.com/tools/security-header#url=' . $currentURL,
    'meta' => [ 'title' => esc_html__( 'HTTP Header Check', 'rank-math' ), 'target' => esc_html__( '_blank' ) ],
    ));

    $wp_admin_bar->add_node( array(
    'parent' => 'rank-math-third-party',
    'id' => 'speedvitals',
    'title' => esc_html__( 'SpeedVitals', 'rank-math' ),
    'target' => esc_html__( '_blank', 'rank-math' ),
    'href' => 'https://speedvitals.com/ttfb-test/?url=' . $currentURL,
    'meta' => [ 'title' => esc_html__( 'SpeedVitals', 'rank-math' ), 'target' => esc_html__( '_blank' ) ],
    ));

    $wp_admin_bar->add_node( array(
    'parent' => 'rank-math-third-party',
    'id' => 'webpagetest',
    'title' => esc_html__( 'WebPageTest', 'rank-math' ),
    'target' => esc_html__( '_blank', 'rank-math' ),
    'href' => 'https://www.webpagetest.org/?url=' . $currentURL,
    'meta' => [ 'title' => esc_html__( 'WebPageTest', 'rank-math' ), 'target' => esc_html__( '_blank' ) ],
    ));
    }
    }
    add_action( 'admin_bar_menu', 'add_submenu_links', 999 );

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