You are here:  » Related products for WP posts

Support Forum



Related products for WP posts

Submitted by sociallyfamous on Thu, 2015-03-12 21:39 in

Hi again.

I am looking for a way to display products on a WordPress post. However, the products should be relevant to the post.

David or anyone else reading this, do you have any ideas on how to make this work?

My first guess would be to use the Keywords shortcode in combination with the post tags or a custom field keyword. How feasible is that?

If we are to use the tags, would the search return anything at all? A first attempt to search for 5 keywords did return 0 results. I am not surprised.

So then I would need a single keywords inside a custom field and somehow make the shortcode use it.

What other solutions am I not aware of here?

Any info would be much appreciated. :)

Submitted by support on Fri, 2015-03-13 09:42

Hi,

If you wanted to experiment further using the post title as a keyword search that's no problem - in pto.php if you look for the following code at line 404:

      switch($k)

...and REPLACE with:

      $v = str_replace("%THE_TITLE%",the_title("","",FALSE),$v);
      switch($k)

...you can then use %THE_TITLE% in any shortcode to use the post title, e.g. within your post template:

[pto search="%THE_TITLE%"]

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by sociallyfamous on Fri, 2015-03-13 12:46

Yes this worked. I have to see how I can make the results more relevant and how to exclude 3 letter searches from the queries to improve speed.

It is a good start for further experimentation.

Thanks David