troubleshooting Question

Add php code to javascript slideshow

Avatar of Reece
ReeceFlag for Australia asked on
JavaScriptCSSPHP
10 Comments3 Solutions423 ViewsLast Modified:
There is a "quote" section on my current WP theme (@ http://lillypillyps.com.au) home page that I would like to replace with a "cycling" banner of sorts.

Similar to the testimonials on this site's header, I want it to display a random testimonial on page load and cycle through all others.

I have a posts category called "testimonials" (ID=4) that I want it to pull the title and content from for this.

So far, I've managed to figure out how to pull a testimonial at random and display on my home page (if you see the page source, you will see that I've commented out the original content for this area of the home page)...

How can I implement what I have so far with the script used on this site's header?

<script type="text/javascript"> 
    $(document).ready(function() { 
            $('#escape').fadeIn(3000).delay(2000).fadeOut(3000); 
            $("#quotes").load("quotes.html",function() {
        $quotes = $("p.quotes");
        var q = Math.floor( Math.random() * $quotes.length );
        $quotes.eq(q).addClass("next"); // set the next to fade
        f();        
    })
});
function f() {
    $(".next").fadeIn(3000).delay(2000).fadeOut(3000, function() {
        // fadeout ended, we prepare the next one
        $(this).removeClass("next");
        $(this).next("p.quotes").addClass("next");
        if($(".next").length==0) $("p.quotes:first").addClass("next");
        f();
    });
}
</script>

Because that script is just loading a flat html file and using the <p> with the "quotes" class...

Thanks in advance.
ASKER CERTIFIED SOLUTION
Pyromanci

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros