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.

Is possible change class to body_class() after ajax call to load posts/pages? I would say no, but I have not used much with wordpress ajax, so I ask the question.

share|improve this question

1 Answer 1

Your best bet would be to change the body class (either add class or remove class) with jQuery after the ajax call as a callback.

$.ajax({
  url: "yourloop.php",
  context: document.body
}).done(function() { 
  $(this).addClass("finished-loop");
});

http://api.jquery.com/jQuery.ajax/

share|improve this answer
    
thanks, but the problem is detect type the posts/pages without many lines the code. If not myself clear. Sorry but my english! –  23r9i0 Jul 21 '12 at 14:40
1  
Do you have the code for your ajax call? –  Rachel Baker Jul 21 '12 at 16:12
    
No, sorry. I have a test but does not work 100%. So I decided to ask this question because I need the classes so that the design works well. –  23r9i0 Jul 21 '12 at 17:39

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.