You’re absolutely right. The theme titles are done differently. this is the code they use to display the title.
}
$alignment = get_post_meta($post_id, 'alignment', true);
$title_style_h1 = array();
$title_style_subtitle = array();
$title_box_bg_color = get_post_meta( $post_id, 'title_box_bg_color', true );
$title_box_font_color = get_post_meta( $post_id, 'title_box_font_color', true );
$title_box_line_color = get_post_meta( $post_id, 'title_box_line_color', true );
$title_box_custom_bg_image = get_post_meta( $post_id, 'title_box_custom_bg_image', true );
$title_tag = (empty(get_post_meta( $post_id, 'title_tag', true ))) ? 'h2' : get_post_meta( $post_id, 'title_tag', true );
$sub_title = get_post_meta( $post_id, 'sub_title', true );
$breadcrumbs = get_post_meta( $post_id, 'breadcrumbs', true );
$breadcrumbs_font_color = get_post_meta( $post_id, 'breadcrumbs_font_color', true );
$title_box_subtitle_font_color = get_post_meta( $post_id, 'title_box_subtitle_font_color', true );
$sub_title_instead = get_post_meta($post_id, 'sub_title_instead', true);
if( empty($alignment) || is_post_type_archive(stm_listings_post_type()) ) {
$alignment = 'left';
}
I think this the actual code that displays the title.
$title_tag = (empty(get_post_meta( $post_id, 'title_tag', true ))) ? 'h2' : get_post_meta( $post_id, 'title_tag', true );
Is there a possibilty to hook into it?
Another solution I might be thinking of, is instead of trying to hook into the pages title, how about I echo (as an H1 title) the yoast meta-title (I’ve set using the same code with wpseo_title)
I’ve tried it with this code
echo get_post_meta($post->ID, '_yoast_wpseo_title', true);
But I think the _yoast_wpseo_title key returns the title of post-type and not the custom title I’ve just made
I’ve also tried it with this code…
<h1 class="archive-title"> --------------> this is Line 3
<?php
if ( is_tax() ) :
$taxonomy = get_queried_object()->taxonomy;
$term_id = get_queried_object()->term_id;
$meta = get_option( 'wpseo_taxonomy_meta' );
$title = $meta[$taxonomy][$term_id]['wpseo_title'];
//printf( '<pre>%s</pre>', print_r( get_option( 'wpseo_taxonomy_meta' ), 1 ) );
if ( isset($meta) && !empty($title) ) :
echo apply_filters( 'the_title', $title );
else :
single_term_title();
endif;
endif;
?>
</h1>
This keeps returning a Parse error: syntax error, unexpected '<', expecting end of file in .......................stm_classic_filter.php on line 3 no matter what I do
What would you suggest?