Hi @tjohnston,
I believe this is possible by using the pre
filter, as shown in the snippet below.
Do note that the snippet below is hypothetical and you’ll need to adjust the $custom_field
variable.
add_filter( 'the_seo_framework_pre_add_title', function( $title, $args ) {
if ( is_singular() ) {
//= term_id is also the post ID.
$custom_field = get_post_meta( $args['term_id'], 'my_custom_field', true );
if ( $custom_field ) {
$tsf = the_seo_framework();
//= Whether internal custom fields are enabled, fetch that.
if ( $args['get_custom_field'] )
$title = $tsf->get_custom_field_title( $title, $args['term_id'], $args['taxonomy'] );
//= When no custom field is found, generate a title.
if ( empty( $title ) )
$title = (string) $tsf->generate_title( $args, false );
if ( $title ) {
$title = $title . ' ' . $custom_field;
} else {
$title = $custom_field;
}
}
}
return $title;
}, 10, 2 );
Also, note that this is a bit of a hack. To make this less of a hack, I’m planning to restructure the title generation for 3.1, which might/should result in your original method working again:
https://github.com/sybrew/the-seo-framework/issues/202
I hope this helps you get you on your path ?? Happy holidays!