WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Using the 'Focus Keyword' in PHP (2 posts)

  1. grfxarmy
    Member
    Posted 1 year ago #

    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/

  2. ThermalStudios
    Member
    Posted 1 year ago #

    Revision to my previous post: Works on WordPress 3.5 with Yoast SEO 1.3.4.1!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic