Use shortcode to alter template file
-
Is it possible to use a shortcode (within the html editor) to alter the page template file (selected for that specific page) to send variables to the template file?
For example: I have added a template called Vehicles to my page. Normally this would show me all vehicles. But I want to filter that specific page only on rentals. So I would add a shortcode [vehicles type=”rental”]. Adding the shortcode function to functions.php is not a problem, but setting a variable that can be read in the template file is.
I have tried it with globals, sessions etc. but nothing is working. Can someone please help?
Thanks in advance.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Use shortcode to alter template file’ is closed to new replies.