Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hi @terence,

    That’s a great idea! It does require a new metabox as it’s not bound to Webmaster or anything else.
    Expect a free separated plugin for these kinds of things in the future :).

    For now, please use the following code to add the verification ID:

    add_action( 'init', 'my_alexa_code' );
    
    function my_alexa_code() {
    
    	if ( is_front_page() )
    		add_filter( 'the_seo_framework_pro', 'my_alexa_code_output' );
    
    }
    
    function my_alexa_code_output() {
    	// Change this. Keep the apostrophes at the beginning and end.
    	$alexa_id = 'myIDcode-1234567aBc';
    
    	echo '<meta name="alexaVerifyID" content="' . esc_attr( $alexa_id ) . '"/>';
    
    }

    This code will be cached if you use object caching, but it’s very light weight already.

    Thanks and have a great day!

    P.S. I have not tested the code but it should work 😀

    Thread Starter Terence Milbourn

    (@pubdirltd)

    “P.S. I have not tested the code but it should work :D”

    I tried it as a dynamic snippet and as an entry in my child theme functions.php, but it doesn’t appear to 🙁

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi @terence,

    Whoops! Filters can’t echo 😛 My mistake, I’m getting tired :3

    A reworked version of the code above, simpler and more effective. This one works 🙂

    add_filter( 'the_seo_framework_pro', 'my_alexa_code_output' );
    /**
     * Add alexaVerifyID after The SEO Framework output.
     * Is already hooked on init.
     *
     * @return string|void The Alexa Verify ID meta tag.
     */
    function my_alexa_code_output() {
    	//* Change this. Keep the apostrophes at the beginning and end.
    	$alexa_id = 'myIDcode-1234567aBc';
    
    	if ( is_front_page() )
    		return '<meta name="alexaVerifyID" content="' . esc_attr( $alexa_id ) . '"/>' . "\r\n";
    
    	return;
    }
    Thread Starter Terence Milbourn

    (@pubdirltd)

    Now that one works perfectly and puts it right where it ought to be.

    Many thanks Sybre.

    Plugin Author Sybre Waaijer

    (@cybr)

    You’re welcome Terence 😀

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘alexaVerifyID support’ is closed to new replies.