0

I created this news ticker: http://jsfiddle.net/riffaz/92s92k1d/ and it's working fine in fiddle.

I am trying to add this ticker to the site. For that I put this code on a PHP widget

<?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $author_id=$post->post_author;
    $args = array('cat'=> 7, 'posts_per_page' => 5, 'paged' => $paged, 'orderby' => date, 'order' => ASC );        
    query_posts( $args);?>  
        <ul class="list-6 ticker" style="height: 82px;">
            <?PHP while (have_posts()) : the_post();?>
            <li>
                <h5>
                    <a class="upcomnig" href="<?php the_permalink() ?>" title="<?php the_title();?>">
                        <?php echo get_upcoming_date();?> 
                        <span style="font-size:16px; color: #fe5e08"><?PHP echo get_upcoming_title(); ?></span>
                    </a>
                </h5>
            </li>   
            <?php   endwhile;?> 
        </ul>   

I put this line into child theme style.php

.ticker {
    height: 75px;
    overflow: hidden;
}

Then on child theme footer.php : I put following code(right above the tag):

function tick(){
        $('.ticker li:first').slideUp( function () { $(this).appendTo($('.ticker')).slideDown(); });
    }
    setInterval(function(){ tick () }, 5000);

It does nothing on my home page. It stays where they are on the home page. But if I go to any pages it's working fine. weird. Any ideas how to fix this?

http://www.ldjf.org/ look at the bottom right area.. Footer area upcoming events

3

the console is firing this error:

TypeError: $ is not a function

Could be a few things:

WordPress loads jQuery in no-conflict mode so you may need to use jQuery instead of $ when making your selections

jQuery('your-selector)

Be sure that jQuery has loaded before you set your interval. Based on what I can see you may be trying to access if before it's loaded?

Hope it helps

  • 1
    Type jQuery into the js console on that site and it returns a good result, it is indeed a fix to one of the original issues – Tom J Nowell Aug 15 '14 at 18:45
  • thanks guys. All $ has been replaced as jQuery and now it's working fine. – Riffaz Starr Aug 16 '14 at 3:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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