How To: Add WordPress Widgets to your Posts and Pages
I’m the process of setting up my personal portfolio for my writing services, using WordPress of course, and I was thinking of ways to easily add different types of content, from different sources, to my pages.
One simple yet effective way of making my pages a bit more interesting as well as displaying other types of content, was to add the widgets that are usually displayed in the sidebar to posts and pages.
By doing this you could use the standard WordPress widgets to display a list of recent posts in one of your pages or posts, or you could display the calendar widget in a post. However, using widgets in pages really comes into its own when you start looking at the widgets that most plugins create.
Things You Can Do with In-Post Widgets
One way I discovered I could make my ‘about me’ page more interesting was to use the widget from the Instagram for WordPress plugin and show an image feed from my Instagram account. While this plugin does allow the same functionality by using a shortcode, not all plugins include this feature.
You could also choose to use a plugin widget for a social site, such as a widget displaying your Facebook friends or latest feed activity. The same goes for Twitter and most other social networks.
Another option would be to use the links widget to display a list of links in a page or in a number of pages. These links might be to other sites you write for, such as for use on your portfolio and you might display them on a number of your pages. If you’d simply added that list of links to your posts by hand, when it came to changing them, you’d have to go in and edit each post or page individually. By using the links widget, you can now edit the links that are displayed in that widget and the changes will be reflected on all your posts and pages using that widget.
There really are so many elements you can now add to your posts and pages when you factor in all the different plugins out there that add their own widgets to your list of available options.
How to Add Widgets to Posts and Pages
So now we know why, let’s look at how to display widgets on a post or pages. As with most things in WordPress, the easiest way to get started is to use a plugin, and when it comes to widgets in posts there are a few good options out there.
AMR Shortcode Any Widget
This is a free plugin that allows you to easily create a shortcode for a widget which can then be used to insert or display that widget in a page or post. It doesn’t really do much else but it is very easy to use.
The only downside is that you have to remember the shortcodes for each widget you want to insert into posts (or go back to the widget page to get a reminder). The plugin page states compatibility up to version 3.4.2 but I had no problems using it with version 3.5.2.
Widgetize Pages Light
This is the light version of a premium plugin and is available from WordPress.org. To use this plugin you must first create an additional sidebar, and then add the widgets you want to display in your posts to that sidebar, all of which can be done very easily using the plugin.
On the edit post page there will now be an area where you can add rows and columns to your posts. You can then select which of the sidebars you created will be displayed in this area of the page using a drop down menu.
This plugin not only makes adding widgets to your posts an easy prospect, but it also allows you to add multicolumn layouts to your posts to help you get the look you want for your pages.
Sidebar & Widget Manager for WordPress
This is the premium version of the above plugin and is one that allows you to add sidebars and their widgets to posts and pages. Like the free version it also gives you the ability to create custom page layouts with the built-in page builder
As well as all the features of the free version, this sidebar manager for WordPress allows you to show different sidebars depending on which posts or pages the user is viewing. This is a useful feature that makes upgrading to the premium version a good idea for many types of sites.
Widgets on Pages
This is another free plugin for adding widgets to posts and pages and is a popular choice. Widgets on Pages allows you to use the newly created default widget area for building your widget list, or alternatively, you can create unlimited additional widget areas.
Your widgets can then be displayed on posts and pages using a shortcode which refers to the name you gave that particular widget area. You can also call the existing sidebars your site is using by entering the name of those sidebar areas, which is usually ‘sidebar-1’ and so on.
While this post lacks the page layout abilities of the Widgetize Pages Light plugin, it is still a good choice for those who don’t need that functionality or are using their own page builder tool.
Other Ways to Improve WordPress Widgets
Flexible Posts Widget allows you to display a list of posts on in a widget on your sidebar, or in your posts and pages by using it in combination with one of the above plugins. While the standard recent posts widget displays only your recent posts, this plugin gives you lots more control over which posts to display. Using this tool you can display posts according to their post type and their categories and tags. It also gives you a good amount of control over which order they are displayed in.
Widget Logic is a free plugin that lets you choose which widgets to display on certain posts and pages. The plugin adds a new field to each widget. In that field you can control the pages, posts and categories that widget will appear on. There are many uses for this plugin such as displaying a widget that contains personal photos from Flickr only on your ‘about me’ page, or displaying a list of links only on a page or category that contains content relevant to those links.
The Display Widgets plugin works in a similar fashion to Widget Logic but is a bit easier to use thanks to the use of check boxes for the pages you would like your widgets to be displayed on.
Dynamic Widgets is yet another free plugin that lets you control which widgets are displayed where. It has some impressive features such as only showing certain widgets on certain days of the week.
Widgets Reloaded hasn’t been updated for some time but at the time of writing still works with WP 3.5.2. This is good because this free plugin brings lots of extra functionality to WordPress widgets. Once installed, all your widgets will be given a makeover with extra fields, giving you much more control over they can be used. Widgets can now be used multiple times which previously wasn’t the case.
This is what the humble categories widget looks like after installation of the Widgets Reloaded plugin. As you can see you now have much more control over how your widgets work.
The Colorful Text Widget plugin allows you to bring colour to your text widgets by changing the text, title and background colours of these widgets. By using one of the widgets on page plugins above you can then add your text widgets to your posts and pages creating a colourful text area.
Widgets are a key part of WordPress and they come with lots of plugins for easy display on your sidebars. By using one of these plugins that allows you to display widgets in your posts and pages you can now add dynamic content to your blog, sourced from external services.
By using the standard WordPress widgets you can also save yourself a lot of work by adding content to multiple posts that can be updated from one location, such as by using the menu builder or when adding links to pages via the links widget.