Last active
November 28, 2024 18:20
-
-
Save wp-seopress/f9c7a53065f638b25c5f12087da77b7b to your computer and use it in GitHub Desktop.
Use post meta fields from a JetEngine custom table and SEOPress
This file contains hidden or 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 | |
function sp_titles_template_variables_array($array) { | |
$array[] = '%%my-custom-global-variable%%'; | |
return $array; | |
} | |
add_filter('seopress_titles_template_variables_array', 'sp_titles_template_variables_array'); | |
function sp_titles_template_replace_array($array) { | |
// Replace my_jetengine_custom_field with the name of your meta field (to be used with custom database storage) | |
$array[] = esc_attr(wp_strip_all_tags( jet_engine()->listings->data->get_meta( 'my_jetengine_custom_field' ) )); | |
return $array; | |
} | |
add_filter('seopress_titles_template_replace_array', 'sp_titles_template_replace_array'); | |
function sp_get_dynamic_variables($array){ | |
$array['%%my-custom-global-variable%%'] = 'My new dynamic variable title'; | |
return $array; | |
} | |
add_filter('seopress_get_dynamic_variables', 'sp_get_dynamic_variables'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment