86477

Jquery not working properly in Wordpress

Question:

this is my code for footer.php in wordpress

<div class="col-fr col-space flink" id="a-1"> <h4>title</h4> <?php $menuParameters = array( 'menu' => 'New To website', 'container' => false, 'container_class' => 'footmenu', 'echo' => false, 'items_wrap' => '%3$s', 'depth' => 0, ); echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' ); ?> </div> <div class="col-fr flink col-space" id="a-2"> <h4>title</h4> <?php $menuParameters = array( 'menu' => 'Most Popular', 'container' => false, 'container_class' => 'footmenu', 'echo' => false, 'items_wrap' => '%3$s', 'depth' => 0, ); echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' ); ?> </div> <div class="col-fr flink col-space" id="a-3"> <h4>title?</h4> <?php $menuParameters = array( 'menu' => 'Need Help', 'container' => false, 'container_class' => 'footmenu', 'echo' => false, 'items_wrap' => '<ul>%3$s</ul>', 'depth' => 0, ); echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' ); ?> </div> <div class="col-fr flink" style="margin-right:0px" id="a-4"> <h4>title</h4> <?php $menuParameters = array( 'menu' => 'quicklink', 'container' => false, 'container_class' => 'footmenu', 'echo' => false, 'items_wrap' => '%3$s', 'depth' => 0, ); echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' ); ?> </div> <script> var ul = $("<ul></ul>").appendTo("#a-1"); $("#a-1 a").each(function() { $(this).wrap("<li></li>").parent().appendTo(ul); }); var ul = $("<ul></ul>").appendTo("#a-2"); $("#a-2 a").each(function() { $(this).wrap("<li></li>").parent().appendTo(ul); }); var ul = $("<ul></ul>").appendTo("#a-3"); $("#a-3 a").each(function() { $(this).wrap("<li></li>").parent().appendTo(ul); }); var ul = $("<ul></ul>").appendTo("#a-4"); $("#a-4 a").each(function() { $(this).wrap("<li></li>").parent().appendTo(ul); }); </script>

this script not work normally but if i add

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

to header.php file before

<?php wp_head(); ?> </head>

then its work fine... so what wrong with my code.. i don't want to add jquery add again header. it's load by defult already. version also same.. i tried paste that code heaer.php but not work also tried to make one separate js file for this and load.. but no work..

any solution.. ?

Answer1:

use jQuery instead of $

because most of CMS use <a href="http://api.jquery.com/jQuery.noConflict/" rel="nofollow">noConflict</a>

Recommend

  • Img Src correct, but still not working in index.php
  • Wordpress: Adding a variable inside wp_nav_menu
  • OpenCV OpenNI calibrate kinect
  • Timeout on a php Peg Puzzle solver
  • Can I have a variable number of URI parameters or key-value pairs in Laravel 4?
  • C#: Import/Export Settings into/from a File
  • Validate jQuery plugin, field not required
  • Setting the run time properties on SpringApplicationBuilder()
  • Syntax error on tokens, AnnotationName expected instead - error on query
  • JSR-330 support in Picocontainer : @Inject … @Named(\"xxx)
  • Calculating ratio of reciprocated ties for each node in igraph
  • How can I display the parent menu item's description using Wordpress walkers?
  • How to disable all widgets inside Panel or inside Composite?
  • Extract zip entries to another Zip file
  • Simulate click Geckofx vb,net
  • How does this usort cmp function actually work?
  • Stop Bash Script if Hive Fails
  • How to add git credentials to the build so it would be able to be used within a shell code?
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • Groovy: Unexpected token “:”
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • How to have background script and something similar to a default popup?
  • d3 v4 drag and drop with TypeScript
  • Typescript - Unable to get 'import' statement to function
  • Is there any way to access browser form field suggestions from JavaScript?
  • jQuery show() function is not executed in Safari if submit handler returns true
  • RectangularRangeIndicator format like triangular using dojo
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • Possible to stop flickering java tooltip in heavyweight mode?
  • Shallow update not allowed (git > 1.9)
  • How to model a transition system with SPIN
  • Display Images one by one with next and previous functionality
  • Upload files with Ajax and Jquery
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • Cant find why the layout is getting smaller
  • How to stop GridView from loading again when I press back button?
  • Bitwise OR returns boolean when one of operands is nil
  • sending mail using smtp is too slow
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs