Title: Show/hide widgets based on post length
Last modified: August 30, 2016

---

# Show/hide widgets based on post length

 *  [carolemagouirk](https://wordpress.org/support/users/carolemagouirk/)
 * (@carolemagouirk)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/showhide-widgets-based-on-post-length/)
 * Hello! 🙂
 * Thank you for a fantastic plugin. It’s a life saver.
 * Is there a way to show/hide widgets based on the length of a post or page?
 * I saw this on the wordpress stack exchange but I’m not sure how to implement 
   it or if it’s even the right way to go about it:
    [http://wordpress.stackexchange.com/questions/99585/displaying-a-widget-only-on-long-posts-over-x-characters](http://wordpress.stackexchange.com/questions/99585/displaying-a-widget-only-on-long-posts-over-x-characters)
 * Thanks for any help and keep up the good work!
 * [https://wordpress.org/plugins/widget-logic/](https://wordpress.org/plugins/widget-logic/)

Viewing 1 replies (of 1 total)

 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/showhide-widgets-based-on-post-length/#post-6304868)
 * I think it’s as simple as getting the post content with the_content()
 * [http://codex.wordpress.org/Function_Reference/the_content](http://codex.wordpress.org/Function_Reference/the_content)
 * passing that through str_word_count()
 * [http://php.net/manual/en/function.str-word-count.php](http://php.net/manual/en/function.str-word-count.php)
 * so `str_word_count(the_content())>1000`. May have missed something there.

Viewing 1 replies (of 1 total)

The topic ‘Show/hide widgets based on post length’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/widget-logic_c8dde5.svg)
 * [Widget Logic](https://wordpress.org/plugins/widget-logic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widget-logic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widget-logic/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-logic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-logic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-logic/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [alanft](https://wordpress.org/support/users/alanft/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/showhide-widgets-based-on-post-length/#post-6304868)
 * Status: not resolved