Jquery is not a funciton (wordpress) 에러 발생시

Jquery is not a funciton (wordpress) 에러가 발생하는 이유는 이렇다.

워드프레스가 포함하고 있는 jquery.js 에 jQuery.noConflict() 때문

따라서 jquery 사용시 아래 예제 구문처럼 사용해야한다.

In WordPress jQuery.noConflict() is called on the jQuery file it includes (scroll to the bottom of the file it’s including for jQuery to see this), which means $ doesn’t work, but jQuery does, so your code should look like this:

<script type=”text/javascript”>
jQuery(function($) {
for(var i=0; i <= 20; i++)
$(“ol li:nth-child(” + i + “)”).addClass(‘olli’ + i);
});
</script>

즉,

$(document).ready(function(){  <== 이것을 사용하지 말고
jQuery(function($) { <== 이렇게 사용할것

 

참고: http://stackoverflow.com/questions/3931529/is-not-a-function-jquery-error