• I have a WP blog that compares prices of different products – the problem is that when the price of the product changes, I have to go back and manually edit the 30 or more posts that might refer to that product/price.

    Is it possible to set a static variable e.g. Sony50inchTVprice=”$999″ and then insert that variable “Sony50inchTVprice” into all my posts (instead of the dollar amount), so that when the price goes down, I can just edit the one variable and have it reflect across all my posts?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Which plugin or theme is providing you with the product functionality?

    Thread Starter jgono

    (@jgono)

    What do you mean product functionality?

    I am using Thesis as my theme

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    We’re not given access to commercial themes like Thesis, so we can’t really help you with DIYthemes. Have you contacted them instead?

    Thread Starter jgono

    (@jgono)

    I would have thought my query was independent of any theme..

    I just want to know if there is a way I can insert a variable into a post, repeatedly enter the same variable across more posts, and modify it from a central location.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Yes you can pass data around in WordPress and a common way of doing this is by writing a function in functions.php which grabs your data and returns it. Then calling that function in the page.

    You can call the function through PHP, which can’t be accessed in the Visual or Text tabs when editing a page or post, or through Shortcode. Shortcode can be made using these instructions: http://codex.wordpress.org/Shortcode_API . Shortcode can be called in the Visual tab when editing a page or post.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can I insert a static variable into multiple WordPress posts’ is closed to new replies.