WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.

  url: "yourloop.php",
  context: document.body
}).done(function() { 


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
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


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.