Forums

How do I collapse a div within a post if the word count is less then X amount (6 posts)

  1. bobinder
    Member
    Posted 3 years ago #

    hello people, its Bobinder here and my question is:

    How do I collapse a div within a post, if the "wordcount" relating to that post is less then X amount?

    appreciate any insight you can shed on this topic =D

  2. bobinder
    Member
    Posted 3 years ago #

    i think there's some javascript involved and thats where i lack the know-how! arhhh!

  3. iridiax
    Member
    Posted 3 years ago #

    I can't think of any easy way to do this. Javascript in posts is tricky in WordPress, see:

    http://codex.wordpress.org/Using_Javascript

    Conditional php with a post character count variable might work, but not within a post.

  4. bobinder
    Member
    Posted 3 years ago #

    you have a fair point there iridiax. do you think you can write me a Conditional php with a post character count variable? creating a php from scratch...is tricky for a complete novice aka me!

    help me out please, if your solution does work i'll work around it!

  5. iridiax
    Member
    Posted 3 years ago #

    Sorry, I'm not that advanced a php coder. The only conditional php I've used is from here:

    http://codex.wordpress.org/Conditional_Tags

  6. bobinder
    Member
    Posted 3 years ago #

    that's ok i didn't know about the Conditional-Tags so thanks iridiax for bringing that to my attention. but this still needs to be solved quickly XD

Topic Closed

This topic has been closed to new replies.

About this Topic