change title page on search result

I want to change in my search result the title. Unfortunately I don’t have option to change this in , because I must do it in plugin file.

Actually I have that code in PHP file:

if (isset($_GET[‘search_region’]) ) {
if (isset($_GET[‘search_region’]) ) {
foreach ($cat as $catid => $categories) {
foreach ($city as $idRegion => $region) {
if ($_GET[‘search_categories’] == $catid && $_GET[‘search_region’] == $idRegion) {
printf(‘<h1 class=”cat-title”>%s %s</h1>’, $categories, $region);

**
?>
<script type=”text/javascript”>
document.title = “<?php printf(‘%s %s’, $categories, $region); ?>”;
</script>
<?php
**
}
}
}
}
}
echo ‘</div>’;

Everything is good, bad is only this what is between **. It would be fine but it only changing title on page bar, in the page code is unchanged.
Do you have any idea how I can changing title in in this space?

Read more here:: change title page on search result

Leave a Reply

Your email address will not be published. Required fields are marked *