Jquery tabs don´t work on my Feather powered Wordpress theme

Jquery tabs don´t work on my Feather powered Wordpress theme

I have a tabbed Wordpress widget here to display recent comments, posts and tags. It doesn´t work like should with jquery-tabs. It loads each tab under each other instead of just changing content. The code is here:

  1. <?php

  2. class Bandit_Tabs extends WP_Widget {

  3. /**
  4. Constructor
  5. **/
  6. function Bandit_Tabs() {
  7. parent::WP_Widget(false,$name='Bandit Tabbed Widget');
  8. }

  9. /**
  10. Widget
  11. **/
  12. function widget($args, $instance) {
  13. extract( $args );
  14. $instance['title']?NULL:$instance['title']='';
  15. $title = apply_filters('widget_title',$instance['title']);
  16. $tab_post_thumbnails = $instance['tab_post_thumbnails'];
  17. $tab_popular_title = $instance['tab_popular_title'];
  18. $tab_recent_title = $instance['tab_recent_title'];
  19. $tab_comments_title = $instance['tab_comments_title'];
  20. $tab_tags_title = $instance['tab_tags_title'];
  21. $output = $before_widget."\n";
  22. if($title)
  23. $output .= $before_title.$title.$after_title;
  24. ob_start();
  25. ?>



  26. <div class="bandit-tabs">
  27. <ul class="tab-links clearfix">
  28. <li id="bandit-tab1"><a href="#tabs-1"><?php echo $tab_recent_title; ?></a></li><li id="bandit-tab2"><a href="#tabs-2"><?php echo $tab_popular_title; ?></a></li><li id="bandit-tab3"><a href="#tabs-3"><?php echo $tab_comments_title; ?></a></li><li id="bandit-tab4"><a href="#tabs-4"><?php echo $tab_tags_title; ?></a></li>
  29. </ul>

  30. <div class="tab-inner">

  31. <?php $recent=new WP_Query(); ?>
  32. <?php $recent->query('showposts=5&ignore_sticky_posts=1');?>
  33. <div id="tabs-1" class="bandit_tab">
  34. <ul class="clearfix">
  35. <?php while ($recent->have_posts()): $recent->the_post(); ?>
  36. <li>
  37. <a href="<?php the_permalink(); ?>">
  38. <?php if($tab_post_thumbnails && has_post_thumbnail()): ?>
  39. <span class="tab-entry-image"><?php the_post_thumbnail('thumbnail-tiny'); ?></span>
  40. <?php endif; ?>
  41. <span class="tab-entry-title"><?php the_title(); ?></span>
  42. <span class="tab-entry-date"><?php the_time('F j, Y'); ?></span>
  43. </a>
  44. </li>
  45. <?php endwhile; ?>
  46. </ul>
  47. </div>

  48. <?php $popular=new WP_Query(); ?>
  49. <?php $popular->query('showposts=5&ignore_sticky_posts=1&orderby=comment_count'); ?>
  50. <div id="tabs-2" class="bandit_tab">
  51. <ul class="clearfix">
  52. <?php while ($popular->have_posts()): $popular->the_post(); ?>
  53. <li>
  54. <a href="<?php the_permalink(); ?>">
  55. <?php if($tab_post_thumbnails && has_post_thumbnail()): ?>
  56. <span class="tab-entry-image"><?php the_post_thumbnail('thumbnail-tiny'); ?></span>
  57. <?php endif; ?>
  58. <span class="tab-entry-title"><?php the_title(); ?></span>
  59. <span class="tab-entry-date"><?php the_time('F j, Y'); ?></span>
  60. </a>
  61. </li>
  62. <?php endwhile; ?>
  63. </ul>
  64. </div>

  65. <?php $comments = get_comments(array('number'=>5,'status'=>'approve','post_status'=>'publish')); ?>
  66. <div id="tabs-3" class="bandit_tab bandit_tab_comments">
  67. <ul class="clearfix">
  68. <?php foreach ($comments as $comment): ?>
  69. <li class="clearfix">
  70. <a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?>">
  71. <span class="tab-entry-image"><?php echo get_avatar($comment->comment_author_email,$size='34'); ?></span>
  72. <?php $str=explode(' ',get_comment_excerpt($comment->comment_ID)); $comment_excerpt=implode(' ',array_slice($str,0,11)); if(count($str) > 11 && substr($comment_excerpt,-1)!='.') $comment_excerpt.='...' ?>
  73. <span class="tab-entry-title"><?php echo $comment->comment_author; ?> says:</span>
  74. <span class="tab-entry-comment"><?php echo $comment_excerpt; ?></span>
  75. </a>
  76. </li>
  77. <?php endforeach; ?>
  78. </ul>
  79. </div>

  80. <div id="tabs-4" class="bandit_tab">
  81. <div class="tab-tagcloud clearfix">
  82. <?php wp_tag_cloud(); ?>
  83. </div>
  84. </div>
  85. </div>
  86. </div>

  87. <?php
  88. $output .= ob_get_clean();
  89. $output .= $after_widget."\n";
  90. echo $output;
  91. }

  92. /**
  93. Widget update
  94. **/
  95. function update($new_instance,$old_instance) {
  96. $instance = $old_instance;
  97. $instance['title'] = strip_tags($new_instance['title']);
  98. $instance['tab_post_thumbnails'] = $new_instance['tab_post_thumbnails']?1:0;
  99. $instance['tab_popular_title'] = strip_tags($new_instance['tab_popular_title']);
  100. $instance['tab_recent_title'] = strip_tags($new_instance['tab_recent_title']);
  101. $instance['tab_comments_title'] = strip_tags($new_instance['tab_comments_title']);
  102. $instance['tab_tags_title'] = strip_tags($new_instance['tab_tags_title']);
  103. return $instance;
  104. }

  105. /**
  106. Widget form
  107. **/
  108. function form($instance) {
  109. // Default widget settings
  110. $defaults = array(
  111. 'title' => __('Tabs'),
  112. 'tab_post_thumbnails' => 0,
  113. 'tab_popular_title' => __('Popular'),
  114. 'tab_recent_title' => __('Recent'),
  115. 'tab_comments_title' => __('Comments'),
  116. 'tab_tags_title' => __('Tags'),
  117. );
  118. $instance = wp_parse_args( (array) $instance, $defaults );
  119. $thumbnails = $instance['tab_post_thumbnails']?' checked="checked"':'';
  120. // Build form
  121. $form='<p>';
  122. $form.='<label for="'.$this->get_field_id('title').'">Title <small>(recommended - leave blank)</small>:</label>';
  123. $form.='<input class="widefat" id="'.$this->get_field_id('title').'" name="'.$this->get_field_name('title').'" type="text" value="'.$instance['title'].'" />';
  124. $form.='</p>';

  125. $form.='<p>';
  126. $form.='<input class="checkbox" id="'.$this->get_field_id('tab_post_thumbnails').'" name="'.$this->get_field_name('tab_post_thumbnails').'" type="checkbox"'.$thumbnails.'>';
  127. $form.=' <label for="'.$this->get_field_id('tab_post_thumbnails').'">Show Post Thumbnails</label>';
  128. $form.='</p>';
  129. $form.='<p>';
  130. $form.='<label for="'.$this->get_field_id('tab_popular_title').'">Popular Posts Tab Title:</label>';
  131. $form.='<input class="widefat" id="'.$this->get_field_id('tab_popular_title').'" name="'.$this->get_field_name('tab_popular_title').'" type="text" value="'.$instance['tab_popular_title'].'" />';
  132. $form.='</p>';

  133. $form.='<p>';
  134. $form.='<label for="'.$this->get_field_id('tab_recent_title').'">Recent Posts Tab Title:</label>';
  135. $form.='<input class="widefat" id="'.$this->get_field_id('tab_recent_title').'" name="'.$this->get_field_name('tab_recent_title').'" type="text" value="'.$instance['tab_recent_title'].'" />';
  136. $form.='</p>';

  137. $form.='<p>';
  138. $form.='<label for="'.$this->get_field_id('tab_comments_title').'">Comments Tab Title:</label>';
  139. $form.='<input class="widefat" id="'.$this->get_field_id('tab_comments_title').'" name="'.$this->get_field_name('tab_comments_title').'" type="text" value="'.$instance['tab_comments_title'].'" />';
  140. $form.='</p>';

  141. $form.='<p>';
  142. $form.='<label for="'.$this->get_field_id('tab_tags_title').'">Tags Tab Title:</label>';
  143. $form.='<input class="widefat" id="'.$this->get_field_id('tab_tags_title').'" name="'.$this->get_field_name('tab_tags_title').'" type="text" value="'.$instance['tab_tags_title'].'" />';
  144. $form.='</p>';
  145. // Display form
  146. echo $form;
  147. }

  148. }
Theme combined js file

  1. jQuery(document).ready(function (a) {
  2.     a("#footer a.top,.sc-divider a").click(function () {
  3.         a("html, body").animate({
  4.             scrollTop: 0
  5.         }, "slow");
  6.         return !1
  7.     });
  8.     a("#headstyle-switch").length && a("#headstyle-switch a").click(function (b) {
  9.         b.preventDefault();
  10.         a("#headstyle-switch a").removeClass("active");
  11.         a(this).addClass("active");
  12.         image = a(this).attr("data-image");
  13.         repeat = a(this).attr("data-repeat");
  14.         size = a(this).attr("data-size");
  15.         a("#headstyle-bg div.image").css({
  16.             "background-image": "url(" + image + ")",
  17.             "background-repeat": repeat,
  18.             "background-size": size
  19.         });
  20.         a.cookie("_bandit_header", a(this).parent().index(), {
  21.             expires: 365,
  22.             path: "/"
  23.         })
  24.     });
  25.     a(".entry table").length && a(".entry table tr:odd").addClass("alt-table-row");
  26.     a(".widget_bandit_tabs").length && a(".bandit-tabs").tabs({
  27.         fx: {
  28.             opacity: "show"
  29.         }
  30.     });
  31.     a(".sc-tabs").length && a(".sc-tabs").tabs({
  32.         fx: {
  33.             opacity: "show"
  34.         }
  35.     });
  36.     a(".toggle-box").length && a("h4.toggle-title").click(function () {
  37.         a(this).toggleClass("toggle-title-active");
  38.         a(this).parent().find(".toggle-inner").toggle();
  39.         return !1
  40.     })
  41. });


What could be the cause of this? I can´t figure out what´s wrong.