You are here:  » Wordpress shortcode to insert prices external


Wordpress shortcode to insert prices external

Submitted by NiceGuyEddie on Fri, 2016-09-16 11:11 in

Hi,

I have a WordPress installation at https://example.com and a price tapestry installation at https://pt.example.com

As I understand, to insert a price comparison table into a blog post on the WordPress installation I will need to use pricesExternal.php. However, as you cannot insert PHP code into a WordPress post I will need to create a shortcode with a variable for the product name in functions.php.

I have been searching for instructions how to accomplish this but still haven't found anything. Can anyone help?

Thanks

Submitted by support on Fri, 2016-09-16 11:26

Hi,

If you have, or would be able to make changes so that WordPress and Price Tapestry share the same MySQL database, one option is to use the PriceTapestry.org for WordPress plugin. That would add support for the shortcode;

[pto prices="Product Name"]

(full list of supported shortcodes is here)

The instructions describe setting up a WordPress page that contains the virtual PriceTapesty.org generated content, referred to as the "Container Permalink" - if you only want to use the plugin to pull in Price Tapestry generated content via shortcodes you can leave this page unpublished so that it does not become part of your site at all.

Alternatively, there are a number of plugins that enable PHP code execution within posts such as Exec-PHP, which would enable you to use pricesExternal.php from within a WordPress post.

Cheers,
David.
--
PriceTapestry.com

Submitted by NiceGuyEddie on Fri, 2016-09-16 13:30

Thanks for the reply David,

Ideally I want to keep them in a separate database so that I have the option of using the one PT installation to serve multiple WordPress installations on the same server.

I have looked at various plugins for inserting php in WordPress posts but they all appear to have been abandoned by their developers and have not been checked and updated for the latest versions of WordPress.

I will persevere and try and build a custom shortcode to insert the pricesExternal.

Thanks again.

Submitted by support on Fri, 2016-09-16 13:40

No worries!

Don't forget that you can have multiple WordPress installations in a single MySQL database since the table prefix is configurable in wp-config.php, just as it is with Price Tapestry ($config_databaseTablePrefix at line 30 of config.php).

Cheers,
David.
--
PriceTapestry.com

Submitted by NiceGuyEddie on Thu, 2016-09-22 15:22

Hi David,

After looking at, and being very impressed by the Price Tapestry Wordpress plugin I have decided to use that instead.

However, I would like to edit the output of the [pto prices] shortcode. Where can I find this in the plugin?

Thanks

Paul

Submitted by support on Thu, 2016-09-22 15:38

Hi Paul,

Thank you for your comments!

The [pto prices="Product Name"] shortcode generates just the price comparison table component of the dynamically generated product pages, so the output is entirely generated by the Prices Before / Each / After templates, which you have full control of (in conjunction with the plugin file resources/pto.css) from /wp-admin/ > Settings > PriceTapestry.org.

(more info on template modification here)

Cheers,
David.
--
PriceTapestry.com

Submitted by NiceGuyEddie on Thu, 2016-09-22 16:28

Perfect! Thanks