Hi William,
We planned to add this as a feature long ago, but I never got around to implementing it.
In the meantime, you can do this with filters. You need to replace the my_meta_key
part with the meta key you wish to retrieve.
add_filter( 'the_seo_framework_title_from_generation', function( $title, $args ) {
$post_id = 0;
if ( null === $args ) {
// In the loop.
if ( is_singular() )
$post_id = get_queried_object_id();
} elseif ( ! $args['pta'] && ! $args['taxonomy'] ) {
// Singular custom query (admin inputs, SEO Bar, etc.)
$post_id = $args['id'];
}
$post_type = $post_id ? tsf()->get_post_type_real_ID( $post_id ) : '';
if ( 'my_post_type' === $post_type ) {
$post_meta = get_post_meta( $post_id, 'my_meta_key', true );
if ( $post_meta )
$title .= "– $post_meta";
}
return $title;
}, 10, 2 );
To learn where to implement filters, please see https://tsf.fyi/docs/filters#where.
-
This reply was modified 2 years, 9 months ago by Sybre Waaijer. Reason: More robust checking in filter