-
I’ve set Rank Math’s Titles and Meta for each CTP main archive, category and tags. They display correctly inside the <title> tags for each page.
Is there a way to show the same titles on the page? I’ve tried:
<?php echo get_the_title(); ?>
<?php the_title(); ?>
in the header.php and also tried using a shortcode in functions.php
add_shortcode('rm_title', 'rm_shortcode_title');
function rm_shortcode_title(){
$obj = get_queried_object();
if($obj instance of WP_Post){
return get_post_meta($obj->ID, 'rank_math_title', true);
}if($obj instance of WP_Term){
return get_term_meta($obj->term_id, 'rank_math_title', true);
}
}But what I get is what the plugin that created these CPTs generates.
Any suggestions?
You must be logged in to reply to this ticket.