Last active
November 28, 2024 18:20
-
-
Save wp-seopress/6e88d42396fbbda581b5e16eca0acff1 to your computer and use it in GitHub Desktop.
Add predefined dynamic variables from Jet Engine to SEOPress' schemas
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 | |
| add_filter('seopress_schemas_mapping_select', 'sp_schemas_mapping_select'); | |
| function sp_schemas_mapping_select($select) { | |
| //Add the new group option + option to the list | |
| $select['Jet Engine'] = [ | |
| 'my_new_dynamic_variable_key' => __('My new dynamic variable title', 'wp-seopress-pro'), | |
| ]; | |
| return $select; | |
| } | |
| add_filter('seopress_schemas_dyn_variables', 'sp_schemas_dyn_variables'); | |
| function sp_schemas_dyn_variables($vars) { | |
| //add the variable key | |
| $vars[] = 'my_new_dynamic_variable_key'; | |
| return $vars; | |
| } | |
| add_filter('seopress_schemas_dyn_variables_replace', 'sp_schemas_dyn_variables_replace'); | |
| function sp_schemas_dyn_variables_replace($values) { | |
| // Replace my_jetengine_custom_field with the name of your meta field (to be used with custom database storage) | |
| $values[] = esc_attr(wp_strip_all_tags( jet_engine()->listings->data->get_meta( 'my_jetengine_custom_field' ) )); | |
| return $values; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment