Hi again, David,
There’s an API available, so you can create your personalized shortcodes 🙂
Here’s the code that you’d want to implement, like in your child-theme’s functions.php file, or a custom plugin:
add_shortcode( 'tsf-description', function( $atts ) {
$atts = shortcode_atts( [
'id' => null,
'taxonomy' => '',
], $atts );
if ( function_exists( 'the_seo_framework' ) ) {
$args = null;
if ( isset( $atts['id'] ) ) {
$args = [
'id' => $atts['id'],
'taxonomy' => $atts['taxonomy'],
];
}
return esc_html( the_seo_framework()->get_description( $args ) );
}
return '';
} );
And here are some example shortcodes that work with it:
1: [tsf-description] // Gets current query description.
2: [tsf-description id=1] // Description from page/post ID 1.
3: [tsf-description id=1 taxonomy=category] // Description from category ID 1
I hope this is useful! Cheers 🙂
Hi @cybr,
works perfectly and as expected.
Thanks for your help!
Thanks and best,
David
-
This reply was modified 7 years ago by
David181.