Skip to content

Instantly share code, notes, and snippets.

@koen12344
Last active January 28, 2022 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koen12344/878a2c2249637a36f334fee1224224e5 to your computer and use it in GitHub Desktop.
Save koen12344/878a2c2249637a36f334fee1224224e5 to your computer and use it in GitHub Desktop.
<?php
if(interface_exists('\PGMB\Placeholders\VariableInterface')){
class PGMBYoastSEOVariables implements \PGMB\Placeholders\VariableInterface {
private $parent_id;
public function __construct($parent_id) {
$this->parent_id = $parent_id;
}
public function variables() {
return [
'%yoast_wpseo_metadesc%' => get_post_meta($this->parent_id, '_yoast_wpseo_metadesc', true),
];
}
}
}
add_action('mbp_placeholder_decorators', function($decorators, $parent_post_id, $location){
if(class_exists('PGMBYoastSEOVariables')){
$yoast_seo_variables = new PGMBYoastSEOVariables($parent_post_id);
$decorators[] = $yoast_seo_variables;
}
return $decorators;
}
,10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment