Skip to main content
We are Brand SEO Beijing serving international business, your marketing partner, Contact us by

Several advanced uses of website widgets

Like plugins, widgets of website CMS are one of the powerful assistants to help WordPress expand various functions.
However, when most people see widgets, the first thing that comes to mind is "a tool to rearrange the small sections of the sidebar" without any code.This idea is correct, but this is just the tip of the iceberg of widget usage.
1. Widget Logic plugin
Sometimes you may want to display different widgets on different pages. The Widget Logic plugin can do that for you.
After the plugin is installed, an input box for Widget Logic will appear in the option box of the widget you are using.You can fill in various WordPress conditional tags in this input box to determine which pages this widget will appear on.
The diagram above shows that the Calendar widget only appears on the page named "Evil".You can use multiple conditional tags to make widgets appear on multiple pages.
Make the current widget only appear on the home page: is_home()
Make the current widget only appear on a single article page: is_single()
Make the current widget appear only on the page: is_page()
Make the current widget only appear on archive pages (such as category pages, tab pages): is_archive()
Make the current widget appear only on the search results page: is_search()
Make the current widget appear on all pages except the home page: !is_home()
Make the current widget appear on the "Advertisement" or "Contact" page: is_page('advertise') || is_page('contact')
2. Make all sections of the blog support widgets
Themes that support widgets have always been popular, but users are no longer satisfied with the only widget area on the theme.How wonderful it would be if all the sections on the page could support widgets.
Regarding multi-region widgets, we published a simple tutorial before.
3. Query Posts tool
The Query_posts template tag is a powerful WordPress function that you can use in a loop to call posts and pages.
If you don't know PHP code but want to take advantage of the query_posts tag's capabilities, you can use the Query Posts tool to call up WordPress logs and pages and display these logs in a variety of ways.
After installing and enabling the gadget, you will find a new option called Query Posts in the background gadget menu.
What Query Posts can do:
Display logs by tag, category, author, time, date or custom value
Displays a log of user-specified numbers
Sort logs by publication time, title or ID (ascending or descending)
Display logs in full text, summaries, or lists
Display the WordPress page

Back to Top