Add Wooslider PHP to your index template

Ok so here’s another of my probably wrong and misguided posts instructing you how to add Wooslider to your WordPress site.

If I’m wrong on anything, let me know in the comments below 😀

A few people asked how to add the code to your site. Well, you simply need to add the slider into the page code where you want it to appear.

Basic embed code is:

<?php wooslider(); ?>

This should display the slider in your template wherever you place it.

Nobody wants to use that though, so use my previous post (and particularly the comments from Ben!) to create the embed code you really want using shortcodes.

Something like this:

<?php if (function_exists(‘wooslider’)) echo do_shortcode(‘[wooslider slider_type=”posts” limit=”3″ link_title=”true” layout=”text-bottom” overlay=”full” category=”homepage-feature-post”]’); ?>

Ok, I read the last post…I get it. But now what?

Ok this is probably easier than you think.

To add it to the index page of Mystile, log into WP admin and browse to Appearance > Editor

Open up the Main Index Template (index.php)

When you open it, each ‘piece’ of PHP code is a section of the page. The top one gets the header, the next one gets the content.

You probably want to add your slider above the content section.

See the pic below (click for embiggenness)

You can see that I have added the code in a div that I have chosen to call “wooslider”. You don’t HAVE to do this, it will work if you just stick the PHP code in there without any divs at all. The nbenefit if you do is that you can style the div with CSS.

I suggest you do.

You can then open up your CSS (or child CSS) file and add some styling for the slider.

See the pic below (click for biggerosity)

So. That’s it. Probably full of errors and probably not the best way to do it but that’s my method and it works for me.

Hope it helps 😀

Author: Jim O

Hi I'm Jim and I run SuperCreatives which is basically me tapping at a keyboard and sometimes talking to people and working on stuff that helps people sell, communicate or promote things online. If you need to sell, communicate or promote things online...get in touch!

Leave a Reply

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