Wordpress widgets are a powerful feature to add flexibility to the WordPress powered website. It allows end users to easily add new features & functionality in the sidebar or whatever widgetized areas a theme supports. By default, there are some most commonly used widgets in WordPress widget panel. And you can always add new widgets either by hand-coding them or by installing the specific plugins for extending the utility of the widgets. Here are some such neat tricks which will help you in making the most of these nifty drag and drop widgets.
Add Logic To Your Widgets With Widget logic
The first thing you can do to power up the WordPress widgets is to add the programmer’s logic to it. And widget logic does it for you. The Widget Logic allows you the flexibility of showing or hiding specific widgets on specific pages. Widget logic adds a logic box to each widget and allows you to use conditional tags or general PHP to control the appearance of widgets on specific pages for that matter. For instance if you want the Recent Posts widget to show up only on the individual posts, write is_single() in the Widget logic box and you’ll be able to disable widget on all pages except individual post pages. So next time you have to show a widget on certain pages only, you don’t actually need to play around with your code files; you can simply do it from WordPress admin interface.
Create Tabbed Widgets
Just like tabbed windows in content area, you can also have tabbed interface in the sidebar as well. The Tabbed Widgets plugin allows you to create a tabbed interface to show multiple widgets without occupying much of the browser real estate. You can therefore include tabbed interface for including multiple widgets each showcasing your Recent, Most Popular and Featured posts for instance in the sidebar as a part of effective navigation strategy.
Make Your Text Widgets PHP friendly
Text widgets by default allow you to enter text or HTML code. How about making your text widgets PHP friendly? Check out this little piece of code here to enable PHP in WordPress text widgets to make your text widgets more flexible.
Query Posts with Query Posts Widget
Querying the WordPress posts and fetching featured images & post excerpts is one of the common requirements. And those beginning with WordPress might find it difficult to find the right code for pulling the posts. Query Posts plugin thus offers a simple way to query the posts that’s too through a widget. This widget provides a graphical user interface for specifying the criteria for pulling the posts. If you want to pull featured images along with the post content, all you need to do is check the field which reads “Enable Post Thumbnails”. Quite impressive. So the next time you need to pull the specific posts, you don’t need to juggle with WordPress code, just create a widgetized area and drag & drop the query post widgets, make appropriate settings and you are good to go.
Do you use plugins to power up the widgets? Which one is your favorite?
- How To Integrate Semantic UI Into Your WordPress Theme
- How To Disable WordPress Admin Menu For Specific ‘Admin’ Users
- WordPress Code Snippets — Detecting Page Parent, Child And Ancestor
- How To Remove Yoast SEO Open Graph Site Name Property From Your Website
- 4 Top CSS Front-End UI Frameworks & How You Can Integrate Into Your WordPress Theme