WordPress.org

Ready to get started?Download WordPress

Forums

WordPress jcarousellite (3 posts)

  1. prasanna balaji
    Member
    Posted 1 year ago #

    I am using jacrousellite in my wordpress theme but it is working normally but if I integrate in my theme it is not working how to make it work in my theme

    I have added the library like this in header file

    <script src="<?php bloginfo('template_directory'); ?>/js/jquery-latest.pack.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/js/jcarousellite_1.0.1c4.js" type="text/javascript"></script>

    I have created the script like this in header file

    <script type="text/javascript">
    jQuery(function() {
    jQuery(".newsticker-jcarousellite").jCarouselLite({
    vertical: true,
    hoverPause:true,
    visible: 3,
    auto:500,
    speed:1000
    });
    });
    </script>

    while I create the widget like this it is not working

    add_action("widgets_init", array('Widget_name1', 'register'));
    class Widget_name1 {
    function control(){
    echo 'Scroll Testmonial';
    }
    function widget($args){
    echo $args['before_widget'];
    echo $args['before_title'] . 'Scroll Testmonial' . $args['after_title'];
    $results = mysql_query("SELECT * FROM wp_testmonial");
    ?>
    <div id="newsticker-demo">
    <div class="newsticker-jcarousellite">

      <?php
      while($row = mysql_fetch_array($results)){ ?>

    • <div class="info">
      <b>Name:</b><?php
      echo $row['name'];
      echo '
      '; ?>
      <b>Testmonial:</b><?php
      echo $row['testimonials'];
      echo '
      '; ?>
      </div>
      <div class="clear"></div>
    • <?php
      }
      ?>

    </div>
    </div>
    <?php
    echo $args['after_widget'];
    }
    function register(){
    register_sidebar_widget('Widget Testmonial', array('Widget_name1', 'widget'));
    register_widget_control('Widget Testmonial', array('Widget_name1', 'control'));
    }
    }

    How to make it work can any one help me?

  2. grosshat
    Member
    Posted 1 year ago #

    It's hard to read your code without a minimal formatting.

  3. jmlapam
    Member
    Posted 1 year ago #

    Hi,
    You'd better enqueue your scripts in footer instead of hard coding your header.php : wp_enqueue_script

    Try this and see if it's working, if not it's probably your widget code that doesn't work.

Topic Closed

This topic has been closed to new replies.

About this Topic