We recently needed to replace a WordPress theme and found that the theme we had chosen did not allow us to add a slider to the homepage. We needed to know how to add a Smart Slider to a WordPress home page when the theme doesn’t support it in the free version.
To do this we created slider using Smart Slider and then we just needed to figure out how to add a shortcode to the homepage. After many hours of digging we figured out how to add shortcode to a WordPress home page.
Add a Shortcode To A WordPress Homepage:
- Login to your WordPress site
- Expand APPEARANCE
- Click THEME EDITOR and scan through THEME FILES (on the RIGHT side on the screen)
- Click MAIN INDEX TEMPLATE (INDEX.PHP)
- Scroll down until you see <?PHP
- Insert a line
echo do_shortcode( '[INSERT-SHORTCODE-HERE]' );
- don’t forget the ; at the end of that line
- obviously replace INSERT-SHORT-CODE-HERE with your shortcode – see screenshot below for an example
- Click the UPDATE FILE button (at the bottom)
Click to Expand Screen Shot
This will work immediately unless you have some caching plugin or your hosts provides caching or your browser is caching. In my case I found that while testing with Microsoft Edge (i.e. Chrome) that I had to open an In Private Browsing / Incognito session (CNTL+SHIFT+N).
Note that we also tested this with “Carousel Slider” and found this and others.