You are here:  » Meta title Product & Search


Meta title Product & Search

Submitted by nanaz on Fri, 2016-01-29 12:23 in

Hi David,

I'd already posted this question on an earlier version of PT, but again I can't produce meta titles for both searchresults (categories) and product pages on WP.

I modified pto.php with the code from
http://www.pricetapestry.org/node/374
and
http://www.pricetapestry.org/node/397.

This code worked on another site I have, which uses an earlier version of PT, but not with the new one I'm working on.

The title is formed like this on every product and searchpage:

<strong>Shop | Mysite.nl</strong>

With 'Shop' being the name of my [pto] page. So nowhere the productname or categoryname is being formed.

No SEO-plugins are active and I use the latest WP version.

Pricetapestry plugin settings should be okay: Productpage title =

Mysite.nl | %PRODUCT_NAME%%IF_REVIEW% Reviews%ENDIF_REVIEW%

but apparently that setting is also overwritten. Meta keyword & description are correct.

To be sure I uploaded a freshly downloaded pto-folder to see if already modifications to the various files cause this, but the output remains the same.

Hope you can help me out again!

Cheers, Marlies

Submitted by support on Fri, 2016-01-29 13:08

Hello Marlies,

I'll investigate this further however an earlier method of title override has worked for other users in this scenario - in pto.php look for the following code beginning at line 288:

  if ($title)
  {
    $content = $title." | ".$content;
    if ($title_override && (isset($post) || isset($wp_object_cache->cache["posts"])))
    {
      if(isset($post))
      {
        $post->post_title = $title;
      }
    }
  }

...and REPLACE with:

  if ($title)
  {
    $content = $title." | ".$content;
    if ($title_override && (isset($post) || isset($wp_object_cache->cache["posts"])))
    {
      if(isset($post))
      {
        $post->post_title = $title;
      }
      if(isset($wp_object_cache->cache["posts"]))
      {
        $wp_object_cache->cache["posts"][0]->post_title = $title;
      }
    }
  }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by nanaz on Fri, 2016-01-29 13:48

Hi David,

The modification has no effect. I also added the code to my freshly downloaded pto, but there are also no changes.

Cheers, Marlies

Submitted by support on Fri, 2016-01-29 13:54

Hello Marlies,

Sorry about that, please could you email me the modified pto.php and I'll check it out further / suggest debug code to add to help understand why the title hook is being overridden...

Thanks,
David.
--
PriceTapestry.com