When you create a post using format “asides”, it feels that post is supposed to show up on the sidebar or have some other special meaning. But in the default WordPress themes and in most custom themes nothing special happens. Asides posts are just shown along with all other posts.
So, what’s the point of having different post formats?
By default, WordPress adds a class “format-aside” to the post, plus, allows you to create a custom template to display single posts of each format. Which is really good, but it still will show all posts in one list, regardless of post format.
Sometimes you may want to display those special kind of posts in a different spot. Say, as the name hints, you may want to display “aside” posts on the sidebar.
This is relatively simple task, assuming you are comfortable with some basic custom coding.
Step 1 – remove “asides” from the main loop
As we don’t want “asides” to show up among regular posts, we will use `pre_get_posts` action to modify main WP Query and add a condition to exclude “asides” by the post format. Here is a code sample to do just that. Notice that we added is_admin
check to make sure we won’t hide asides from the admin’s dashboard.
Step 2 – show “asides” in a custom widget
Here is a really simple custom widget to pull latest asides and display them in the sidebar. We will display post title and content. Of course, you can customize it to fit your own needs – for example, add featured image, add filters (for example current category), etc, etc.
That’s it! Now your “asides” are actually shown aside from a main content 🙂
Let me know if you have any questions or just drop a line in the comments if this helped you.