I make a huuk for WordPress, but it also changes other values ​​on the page, which are drawn by the_title(); function the_title(); How to pull out and change only that the_title() which in <h6 class="post_title"><?php the_title(); ?></h6> <h6 class="post_title"><?php the_title(); ?></h6> P.S. The task is to change the_title() particular post. However, in navigation, this function is used in the same way. When I make a huuk to change the post to the the_title() function (which takes out the name of the post), the entire menu takes on the value that is put in place of the_title() post (since there in the menu the page names are also extracted by the_title() ). My huuk:

 add_filter('the_title','add_h1_on_page'); function add_h1_on_page($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 contains the name of the post:

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

    1 answer 1

    Somehow you outwitted yourself. Why such difficulties with hooks, if you can just write your own function that will display the title that you need?

     function my_title($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; } 

    And further in the markup:

     <div class="slider_data"> <a href="">...</a> <?php $title = get_the_title(); ?> <h6 class="post_title"><?php echo my_title($title); ?></h6> </div> 
    • Yeah, already done, pasib) - BonBonSlick