Loading Slider on specific pages
-
Hi
Thanks for a great plugin.
I’ve got the slider working fine on my site. I use Storefront as my theme.
Storefront has a widget area below the header. I’ve added the slider shortcode inside a text widget, and the slider displays fine.The issue is that I only want to show the slider on the home page and prevent the shortcode from being called when the page is not the home page.
So I want to add some code to my child theme functions file to prevent it from loading, but I’m not a coder and I’m getting stuck.
Basically I’m trying to say this:
If the post is not ID 105 (homepage id), then don’t run [soliloquy] shortcode, else run the shortcode.here’s my “code”:
add_action('soliloquy','hp_slider'); function hp_slider() { if !($post_id='105') { exit(); else { do_shortcode('[soliloquy id="1599"]'); } } }
Thank you
- The topic ‘Loading Slider on specific pages’ is closed to new replies.