Last active
January 28, 2022 15:27
-
-
Save koen12344/878a2c2249637a36f334fee1224224e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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