Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This is my website. I installed many plugins but if a plugin have ajax, then it doesn't work in main page. can anybody help me?!?

share|improve this question
    
You included a call to wp_head(), right? –  m0r7if3r Jan 27 '12 at 19:43
    
Does the Codex page not answer all your questions? Try to google before you ask, and if you have, try to explain what that you've seen you find to be confusing or is not functional in your case. –  m0r7if3r Jan 27 '12 at 19:48
    
@m0r7if3r: It's Filter in my country(iran) and I can't see anything from wordpress.com –  ahmadali shafiee Jan 27 '12 at 19:52
    
This question is too localized, and is also off topic. –  Chip Bennett Jan 27 '12 at 19:55
    
@m0r7if3r: I found wp_head() but in a if:<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> <?php wp_head(); ?> –  ahmadali shafiee Jan 27 '12 at 20:02

2 Answers 2

up vote 2 down vote accepted

Taking a look at your code, I noticed one huge issue (also pointed out by Milo). Your script tags (the ones that pull in jQuery and other scripts) are wrong.

For example, this:

<script data-djssrc="http://2barnamenevis.com/wp-content/themes/mediaflux2/js/jquery.min.js" type="text/djs"></script>
<script data-djssrc="http://2barnamenevis.com/wp-content/themes/mediaflux2/js/jquery.nivo.slider.js" type="text/djs"></script>
<script data-djssrc="http://2barnamenevis.com/wp-content/themes/mediaflux2/js/mediaflux.js" type="text/djs"></script> 

Should really be this:

<script src="http://2barnamenevis.com/wp-content/themes/mediaflux2/js/jquery.min.js" type="javascript"></script>
<script src="http://2barnamenevis.com/wp-content/themes/mediaflux2/js/jquery.nivo.slider.js" type="javascript"></script>
<script src="http://2barnamenevis.com/wp-content/themes/mediaflux2/js/mediaflux.js" type="javascript"></script> 

I did some quick Googling to see if I could find out what was causing this. I found some references on the WordPress.org support forums to a pre-beta feature of CloudFlare causing this issue. Specifically:

Yep, turns out it was CloudFlare that was screwing me up. I just got off the phone with support and their explanation was that this feature [beta minify] "is not ready for implementation." I'm still not sure why they have it as an option. FTW. Just disable that, wait about 30 minutes, and you should have your fancy javascript up and working again.

I looked further into your code, and it looks like you are, in fact using CloudFlare:

<script type="text/javascript">
//<![CDATA[
window.__CF=window.__CF||{};window.__CF.u="/cdn-cgi/async/cf/uri/";window.__CF.p="5e/f9847507c0fee91c0268427d3fde85";window.__CF.o=1;window.__CF.c=0;(function(){var a=document,b=a.createElement("script");b.src="//ajax.cloudflare.com/cdn-cgi/nexp/v=918368360/cf_tools.min.js";b.setAttribute("async","true");a=a.getElementsByTagName("script");a=a[a.length-1];a.parentNode.insertBefore(b,a)})();
//]]>
</script></body>

So just follow the instructions from that forum post - turn off the "beta minify" feature and wait. This should turn your JavaScript files back to normal and let you use AJAX on your site.

share|improve this answer
    
I have disabled the beta minify feature but there is no change in the plugin! –  ahmadali shafiee Jan 28 '12 at 9:28
    
From the looks of things, you're also running a cache plugin. You'll need to disable or flush your cache to regenerate the page content. –  EAMann Jan 29 '12 at 2:30

One potential issue is that you have two versions of jQuery being loaded, one is probably hardcoded into your theme's header.php or at least is not using proper wp_enqueue_script method to include scripts.

<script data-djssrc="http://2barnamenevis.com/wp-content/themes/mediaflux2/js/jquery.min.js" type="text/djs"></script>

<script type='text/djs' data-djssrc='http://2barnamenevis.com/wp-includes/js/jquery/jquery.js?ver=1.7.1'></script>
share|improve this answer
    
its the code for wp_header: <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> <?php wp_head(); ?> –  ahmadali shafiee Jan 27 '12 at 20:02
    
@ahmadalishafiee you should remove the first instance hardcoded in your theme, that is not correct and will potentially cause a problem with any plugin that uses jQuery. –  Milo Jan 27 '12 at 20:10
    
@ahmadalishafiee wp_head is not within that if statement, it is functioning correctly. –  Milo Jan 27 '12 at 20:13
    
It was removed at first. –  ahmadali shafiee Jan 27 '12 at 20:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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