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:

  1. Login to your WordPress site
  2. Expand APPEARANCE
  3. Click THEME EDITOR and scan through THEME FILES (on the RIGHT side on the screen)
  4. Click MAIN INDEX TEMPLATE (INDEX.PHP)
  5. Scroll down until you see <?PHP
  6. 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
  7. Click the UPDATE FILE button (at the bottom)

Click to Expand Screen Shot

how to add a shortcode to a wordpress homepage - slider

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.

 


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *