Link to home
Start Free TrialLog in
Avatar of Alicia St Rose
Alicia St RoseFlag for United States of America

asked on

Anything Slider not working on Wordpress site

Hi,
I've been trying to debug this for hours.
I've got an anything slider on the homepage of my Wordpress site. I've used this slider before on other Wordpress sites and it's worked fine.
I'm building the site using a child theme of The Hybrid Framework. I loaded the javascripts by way of hooks and filters in the functions.php.

I checked my code over and over again. It looks accurate but I'm getting no results. I've changed the $ to jQuery in order to avoid javascript conflicts. I have another jQuery script for my twitter updates in the footer and that's working fine. Just no dice with the slider.

can anyone see what I'm missing?

http://sandbox.intrepidrealist.com/my-site/
http://sandbox.intrepidrealist.com/my-site/wp-content/themes/intrepidrealist/js/jquery.easing.1.2.js?ver=3.1
http://sandbox.intrepidrealist.com/my-site/wp-content/themes/intrepidrealist/js/jquery.anythingslider.js?ver=3.1

Below you will find the code I added to my functions.php file.

Thanks!
// add jQuery to head of document
add_action('template_redirect', 'my_init_method');

function my_init_method() {

	if (!is_admin()){
		
		wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js');
    wp_enqueue_script( 'jquery' );
		wp_enqueue_script('jquery.easing.1.2', get_stylesheet_directory_uri() . '/js/jquery.easing.1.2.js');
		wp_enqueue_script('jquery.anythingslider', get_stylesheet_directory_uri() . '/js/jquery.anythingslider.js');
		wp_enqueue_script('jquery.tweet', get_stylesheet_directory_uri() . '/js/jquery.tweet.js');
	
	}

}    

//add twitter script and anything slider script to head
function my_in_head(){ 	?>

	<script type="text/javascript">
		function formatText(index, panel) {
		  return index + "";
	    }
    
        jQuery(function () {
        
        jQuery('.anythingSlider').anythingSlider({
            easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
            autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
            delay: 6000,                    // How long between slide transitions in AutoPlay mode
            startStopped: false,            // If autoPlay is on, this can force it to start stopped
            animationTime: 1000,             // How long the slide transition takes
            hashTags: true,                 // Should links change the hashtag in the URL?
            buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		startText: "",             // Start text
		        stopText: " ",               // Stop text
		        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
            });
            
            jQuery("#slide-jump").click(function(){
                jQuery('.anythingSlider').anythingSlider(6);
            });
            
        });

	}); //end document ready functions

	/* ]]> */
	</script>
	<script type="text/javascript">
	//<![CDATA[

	
    jQuery(document).ready(function(){
        jQuery(".tweet").tweet({
            username: "IntrepidRealist",
            join_text: "auto",
            avatar_size: 36,
            count: 1,
            auto_join_text_default: " ",
            auto_join_text_ed: "I",
            auto_join_text_ing: "I was",
            auto_join_text_reply: "I replied to",
            auto_join_text_url: "I was checking out",
            loading_text: "loading tweets..."
        });
    });
		</script>
		

<?php }

add_action('wp_head', 'my_in_head');

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of David S.
David S.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Alicia St Rose

ASKER

Yay!
Kravimir, you have saved the day again!
It was the extra "});".
I can't see where there are any extra "$".

The slide show works now.

When I saw your name, I knew I'd have my slideshow working in minutes!
You are worth your weight in gold in these forums.

I've got a CSS problem with it. I'll post that as another question.

THANKS again.
Excellent answer as always!
You're welcome.

> I can't see where there are any extra "$".

It's further down the page.  It must be generated elsewhere in the WP code.
  <script type="text/javascript">
    $(function(){ $(".example").each(function(i, e){ eval($(e).text()); }); });
  </script>

Open in new window

Ah, yes it must be from one of my plugins.