Categories: Technical Posted by jasond727 on 7/7/2010 6:22 PM | Comments (0)

Okay,  I have spent the last two days working on getting the EasySlider JQuery plugin to work in my WordPress Plugin.  I am porting my MoviesForMyBlog plugin to wordpress to hopefully get more users to actually enjoy it.

Here we go. This is the html portion

  <script type="text/javascript">
        jQuery(document).ready(function() {
            jQuery("#slider").easySlider({
                prevText: 'Previous',
                nextText: 'Next',
                controlsFade: true,
                speed: 300
            });
        });
    </script>
    <style type="text/css">
        #slider{}
        #slider ul, #slider li{
                margin:0;
                padding:0;
                list-style:none;
        }
        #slider li{
                width:200px;
                height:200px;
                overflow:hidden;
        }
    </style>

    <div id="slider">
        <ul>
            <li>1</li>
            <li>2</li>
        </ul>
    </div>
 

And here is the php part.

//function to add the easy slider script
function mfmb_slider_scripts() {
 wp_enqueue_script( 'easyslider', plugins_url( 'easyslider.js', __FILE__ ),
  array('jquery'), false, false);
}

//adds the script to the header section
add_action( 'init', 'mfmb_slider_scripts' );

I think I made this much more difficult than it needed to be. Hopefully this might help someone out someday.

Comments are closed