What ever you do is going to end up within the h1 tag, but this will keep it out of the menu etc.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | function personnel_filter($x) { $value = get_field('position'); $x = '<div class="person-sub">' . $value . '</div><!--person-sub-->' . $x; return $x; } function jma_person_title_cond($query) { global $wp_query; if ($query === $wp_query) { add_filter('the_title', 'personnel_filter', 10, 2); } else { remove_filter('the_title', 'personnel_filter', 10, 2); } } function jma_child_redirect() { if (is_singular('personnel') && get_field('position')) { add_action('loop_start', 'jma_person_title_cond'); } } add_action('template_redirect', 'jma_child_redirect'); |