• Resolved bravenewniche

    (@bravenewniche)


    I’m using jQuery to toggle some content on a page displaying multiple posts, and here’s something that might save you some time.

    I couldn’t get the content to hide when I use ‘the_content()’, but if I manually put in some text, it worked fine.

    Turned out, it was the fact that ‘the_content()’ contains ‘<p>’ tags from WordPress, and that was clashing with the CSS I had set up in my template.

    Originally I had the content area set as ‘<p class=”itembody”>’ but it only worked when I set it as ‘<div class=”itembody”>’ I tried to have jQuery look for all ‘<p>’ tags within “itembody” and maybe there was a way to make that work and I just didn’t understand how (tried the child symbol > but that didn’t work).

    The resolution came by changing “itembody” to a div instead of a p.

  • The topic ‘Getting content to hide using jQuery – solved CSS naming problem’ is closed to new replies.