Support » Plugin: Yoast SEO » [Plugin: WordPress SEO by Yoast] Using the 'Focus Keyword' in PHP

  • Hi there, wonderful plugin.

    Here is a code snipped for anyone trying to use the “Focus Keyword” in their PHP.

    1) Place the following code into your theme’s functions.php file.

    /*--------------------------------------*/
    /* Use WP SEO Focus Keyword in PHP
    /*--------------------------------------*/
    if(!function_exists('wpseoFocusKW'))
    {
    		function wpseoFocusKW()
    		{
    			$focuskw = wpseo_get_value('focuskw', $post->ID);
    			echo $focuskw;
    		}
    }

    2) Place this code where you want the Focus Keyword to display.

    <?php wpseoFocusKW();?>

    3) Enjoy your Focus Keyword anywhere you want!**

    **I cannot vouch for it working everywhere on every single theme and plugin, but technically it should work 😉

    http://wordpress.org/extend/plugins/wordpress-seo/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] Using the 'Focus Keyword' in PHP’ is closed to new replies.