You are here:  » Brands/Merchants/Category Names as Page Title

Support Forum



Brands/Merchants/Category Names as Page Title

Submitted by Jejos on Mon, 2019-01-28 13:49 in

Hi,

Is there a way to match the page title of the Brand/Merchant/Category name instead of "Shopping"?

I'm actually trying to achieve two things:

1) When a user clicks on the name of the Merchant (e.g. Aroma Home) then the Page Title will be "Aroma Home" followed by the product listings below. It always shows "Shopping" by default.

2) Is there a way to insert the Brand/Merchant/Category name in the Main HTML? I'm using the following code in Main>Search Form:

<div class="title_custom_header"><h4>Search Results For <span style='text-transform:capitalize;'><a>%PTO_Q%</a></span></h4></div>

It returns the searched keyword but if I click on a Brand/Merchant/Category, it shows blank.

Here's a screenshot for reference: {link saved}

I'm currently working on a local server so I'll be unable to send a link to these pages. But the pages that I'm talking about usually have the ffg. URL format in wordpress:

https://example.com/merchant/{Merchant-Name}
https://example.com/brand/{Brand-Name}
https://example.com/productcategory/{Category-Name}

I hope you can help.

Submitted by support on Mon, 2019-01-28 14:39

Hi,

Sure - regarding the page title, edit pto.php pto.php and look for the following code at line 638:

        $title = htmlentities($pto_q,ENT_QUOTES,get_option("blog_charset"));

...and REPLACE with:

        $parts = explode(":",$pto_q);
        if (isset($parts[1]))
        {
          $title = htmlentities(str_replace(array("merchant","category","brand",":"),"",$parts[1]),ENT_QUOTES,get_option("blog_charset"));
          $title_override = TRUE;
        }
        else
        {
          $title = htmlentities($pto_q,ENT_QUOTES,get_option("blog_charset"));
        }

To also have the effective search displayed in the search box, edit pto_search.php and look for the following code at line 275:

  if (pto_common_isContainer() && (strpos($pto_q,":")===FALSE))

...and REPLACE with:

  if (pto_common_isContainer())

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Jejos on Mon, 2019-01-28 15:29

Worked like a charm! Thanks!

Submitted by magnaromagna on Sat, 2021-01-02 15:03

Hi,
I followed your instructions changing into pto/pto.php as following:

// $title = htmlentities($pto_q,ENT_QUOTES,get_option("blog_charset"));
        $parts = explode(":",$pto_q);
        if (isset($parts[1]))
        {
          $title = htmlentities($parts[1],ENT_QUOTES,get_option("blog_charset"));
          $title_override = TRUE;
        }
        else
        {
          $title = htmlentities($pto_q,ENT_QUOTES,get_option("blog_charset"));
        }

but nothing changes on title of category/merchant/brand pages. What I should check?
Thank you again

Submitted by support on Mon, 2021-01-04 09:05

Hi,

Do you happen to be using the Yoast SEO plugin? If so, if provides its own hook for overriding the title so you can add that to pto.php as described in this comment. If you don't have any SEO plugins installed and title is still not be set correctly let me know and I'll check it out further with you...

Edit: I just saw from your new thread that you are using Yoast so this will fix the product page titles not being displayed also (I won't publish that post assuming all is OK having applied this...)

Cheers,
David.
--
PriceTapestry.com