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.

The question is about which way is the best / easiest way to make a theme with ajax, using admin-ajax.php or normally. I ask because I see that complicates using admin-ajax.php for everything and use jquery plugin to enable your browser history for example.

that think?

Sorry for my English!!!

share|improve this question
3  
What does normally mean? This is default way in WordPress to use ajax: codex.wordpress.org/AJAX_in_Plugins and you do not have to use just jQuery. You can enqueue mootools or other js, or just use pure js –  david.binda Jan 28 '13 at 12:45
    
Normally is without using admin-ajax –  23r9i0 Jan 28 '13 at 14:25
    
admin-ajax is recomended and thoug normal way to use Ajax in WordPress... –  david.binda Jan 28 '13 at 14:42

1 Answer 1

Never ever use your theme/plugin files directly for ajax calls, always use admin-ajax.php. This is the only recommended way of doing ajax to ensure maximum compatibility with wordpress (including future versions) & 3rd party plugins/themes

The best/easiest way depends on the situation & is debatable but i would ask you to use admin-ajax.php even if it is hard or inefficient

share|improve this answer
    
the situation is make one theme 100% ajax, posts, pages, search, etc.. but I have one problem to implement wp_query with admin-ajax –  23r9i0 Jan 28 '13 at 14:29
    
@user11721 - if you have a specific issue with using WP_Query with admin-ajax.php, then ask a new question with details of that specific issue. –  Milo Jan 28 '13 at 16:18
    
agree, but my question in using admin-ajax is exactly how I do, because since the function ajax_call for example not find out how to return the page I want to visit. Since it I consider it to make a WP_Query and not return the body_class , wp_footer (for scripts that usage on some pages) and one problem I encounter is with next-page of the post, which pagename=post/second page not works. –  23r9i0 Jan 31 '13 at 20:02

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.