Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I use a news ticker jQuery plugin to show the last posts.

The codes are in the header.php file and work fine on the home page, but not on single pages. The links are loaded but they don't move.

Here is the home page and here the single page.

share|improve this question
    
Please paste actual, relevant code in your question, including anything added manually to header.php, and any wp_enqueue_script() calls relevant to jQuery and its Plugins. Also: what Plugins do you have active? –  Chip Bennett Apr 23 '13 at 15:49
add comment

3 Answers

Your Theme is enqueueing jQuery 1.7.2:

<script type="text/javascript" src="http://dayfun.ir/wp-content/themes/Sparks/lib/js/jquery.min.1.7.2.js"></script>

And WordPress is enqueueing jQuery 1.8.3:

<script type='text/javascript' src='http://dayfun.ir/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script>

See also, Frank's answer regarding jQuery no-conflict mode.

Edit

WordPress bundles a version of jQuery. You will inevitably encounter problems if your Theme (or a Plugin) enqueues a separate version of jQuery - whether by enqueueing that separate jQuery version along side the WordPress-bundled version, or else by deregistering the core-bundled version, and enqueueing a custom version.

Don't register a custom version of jQuery via your Theme or any Plugins. If you need to use jQuery, just use the core-bundled version, via:

wp_enqueue_script( 'jquery' );
share|improve this answer
    
I updated the jquery version to: jquery-1.9.0.min.js . please check the links again. it seems in the single pages there is only one link ( in <li></li>) and all the last posts not loaded. –  pixelweb Apr 24 '13 at 6:03
    
You're still enqueueing two different versions of jQuery. Your Theme should not be enqueueing any custom version of jQuery. Just use the core WordPress-bundled version, via wp_enqueue_script( 'jquery' ). –  Chip Bennett Apr 24 '13 at 12:49
add comment

All the jQuery code in WordPress needs to run in No Conflict mode: http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers

So in your case the initialization of the Plugin needs to be the following:

(function($) {
    $('.vertical-ticker').totemticker({
        row_height  :   '20px',
        speed       :   500,
        interval    :   1800,
        max_items   :   1,
        mousestop   :   true,
        direction   :   'down',
    });
})(jQuery);
share|improve this answer
add comment

You're getting a JS error when trying to load the ticker in the single page:

Cannot call method 'totemticker' of null.

It might be conflict with another plugin, or the totemticket script is not set to load in single pages.

Can you add parts of the header.php code? and perhaps the single.php code?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.