Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Joost de Valk

    (@joostdevalk)

    Yeah sure, just read the code? 🙂

    Thread Starter ModeratoMaestoso

    (@moderatomaestoso)

    Still reasonably newbie-ish to all this stuff Joost 😉

    This seems to work so far (as a test) for the meta description:

    function custom_seo_info() {
    
    	$metadesc = wpseo_get_value('metadesc');
    
    	$martinsmetadesc = apply_filters( 'wpseo_metadesc', trim( $metadesc ) );
    
    	echo '<meta name="custom-meta-tag-name" content="'.esc_attr( strip_tags( stripslashes( $martinsmetadesc ) ) ).'"/>'."\n";
    
    };

    And then in the template call:

    <?php custom_seo_info(); ?>

    🙂 Martin

    Plugin Contributor Joost de Valk

    (@joostdevalk)

    yes that would work 🙂 well done!

    Thread Starter ModeratoMaestoso

    (@moderatomaestoso)

    Sorry…. Me again 🙂

    $metadesc = wpseo_get_value('metadesc');

    works, but fails to take into account the conditionals that are built into the plugin.

    The full code for defining the variable with the conditionals is:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    But it seems a little redundant to duplicate this in a custom plugin… Is there a way of using $metadesc outside the class? It’s not defined as a global variable…

    Martin

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] Functions / hooks for including SEO data elsewhere’ is closed to new replies.