WordPress. How to call the function which lies in a specific div class="smth"?

Do Hook for WordPress, but it changes some other value on the page that vytjagivanija function the_title();
How to get and change only thethe_title()which <h6 class="post_title"><?php the_title(); ?></h6>

PS the Task is to change the_title() of a specific post. However, to navigate, ETA function using the same. When doing Hook to change the post to function the_title()( which minimalise the title of the post ), then the entire menu takes on a value that can be placed in place of the_title()post ( as TAA in the title menu of pages as well poluchaetsya funkierthe_title()).
My Hook:
add_filter('the_title','add_h1_on_page');
add_h1_on_page function($title){
 $seo_post_type = woo_com_check();
if(!empty($seo_post_type)){
 return get_post_meta($seo_post_type->ID,'timworld_seo_h1', true);
}
 return $title;
}

A piece of code which is the name of the post:
<div class="slider_data">
 <a href ...>...</a>
 <h6 class="post_title"><?php the_title(); ?></h6>
 </div>
July 9th 19 at 10:27
2 answers
July 9th 19 at 10:29
Solution
why not make it easier to rewrite the code in the output

<div class="slider_data">
 <a href ...>...</a>
 <h6 class="post_title"><?php echo my_seo_title(); ?></h6>
 </div>


my_seo_title function()
{
 $seo_post_type = woo_com_check();
if(!empty($seo_post_type)){
 return get_post_meta($seo_post_type->ID,'timworld_seo_h1', true);
}
 return the_title();
}
Wankie, only then will have to do the child theme, the current is already different) - jaycee commented on July 9th 19 at 10:32
: add_filter not needed there. in functoin.php write my_seo_title function()
{
$seo_post_type = woo_com_check();
if(!empty($seo_post_type)){
return get_post_meta($seo_post_type->ID,'timworld_seo_h1', true);
}
return the_title();
}
in the template - cleve_Murray commented on July 9th 19 at 10:35
July 9th 19 at 10:31
You need your code:
<h6 class="post_title"><?php the_title(); ?></h6>

replace with:
<?php the_title('<h1 class="post_title"-->', "); ?>


Otherwise, you will have access to the markup outside the_title.

Find more questions by tags PHPCSSWordPress