• I have added stylesheets and javascript files into my html template before using the <?php bloginfo(‘template_url’);?> but for some reason this time my scripts wont work.

    I have implemented this jquery newsticker: http://www.jquerynewsticker.com/

    I have added the scripts to my header.php file as follows:

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/newsticker/styles/ticker-style.css" media="screen" />

    <script src="<?php bloginfo('template_url'); ?>/newsticker/includes/jquery.ticker.js" type="text/javascript"></script>

    But my ticker doesnt show up? when i remove the display:none style from the .js-hidden css tag in the javascript file. my list items show up as bullet points but no animation or anything.

    All my other scripts work fine, including other jquery and css files.

    Thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • http://codex.wordpress.org/Function_Reference/wp_enqueue_script
    Have you read up on registering/enqueueing scripts at all?

    It’s the appropriate way to handle loading in scripts…

    Thread Starter marcweissdesign

    (@marcweissdesign)

    i have done but whenever i seem to do it it doesnt work lol. I am a bit of a newbie with wordpress but need to learn it anyway. Would you know what the full script would be to include a js file using wp_enqueue?

    I have tried a few snippets but they didnt seem to work, and the link is a little confusing. thanks for replying

    http://wordpress.org/support/topic/theme-twenty-eleven-wp_enqueue_script-problems?replies=11
    Maybe the discussion here can help? Unfortunately, jQuery is sooo not my area

    Thread Starter marcweissdesign

    (@marcweissdesign)

    ive had a look at that link and tried to replicate the code but changing the directory of my jquery files.

    This is what i have:

    function my_register_jquery_function() {
      wp_deregister_script('jquery');
      wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false, '1.7.1');
      wp_enqueue_script('jquery');
    
      wp_enqueue_script(
        'li-scroller'
        , get_stylesheet_directory_uri() . '/jquery.li-scroller.1.0.js'
        , array('jquery')
      );
    
    	 wp_enqueue_script(
        'li-scroller'
        , get_stylesheet_directory_uri() . '/jquery_news_ticker/includes/jquery.ticker.js'
        , array('jquery')
      );
    }
    
    add_action('wp_enqueue_scripts', 'my_register_jquery_function');

    according to view source on chrome my files are loaded but it doesnt seem to be be styling my html content nor does it seem to animate like it should.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Jquery and wordpress’ is closed to new replies.