Display custom sidebar – mixed conditions

Note: If you’re not already familiar with how to add sidebars to a single page or all posts, please click here before continuing.

With Content Aware Sidebars you can add unlimited sidebar conditions and mix and match them anyway you like with logical AND, OR and NOT. This means that you can target your sidebars and display them on very specific conditions.

 

When to use AND or OR?

A simple way of determing if a condition should use logical AND or OR is by saying this:

 

Display sidebar only if the visited webpage is a ________ AND/OR a ________

 

Using OR – simple: Display sidebar only if the visited webpage is a Post OR a Page

Using AND – mixed: Display sidebar only if the visited webpage is a Post AND (written by) Author X.

 

In the following examples, the user is editing a sidebar and has already added a condition for all posts. The examples can be read independently, but it is recommended to read them in order.

 

Sidebar for Posts with Tags

Display sidebar on posts with select tags

 

  1. In the Posts condition group, click on the “+ Meet ALL of these conditions“ dropdown and select Tags
  2. Click on the input field saying “All Tags / Tag Archives” and select the tags you want. You can search in the field by typing.
  3. That’s it, the sidebar will now be displayed on all posts with the selected tags!

 

Sidebar for Posts by Authors

Display sidebar on posts by authors

 

  1. In the Posts condition group, click on the “+ Meet ALL of these conditions“ dropdown and select Authors
  2. Click on the input field saying “All Authors” and select the authors you want. You can search in the field by typing.
  3. That’s it, the sidebar will now be displayed on all posts written by the selected authors!

 

Sidebar for Posts published at a select Time

 

  1. In the Posts condition group, click on the “+ Meet ALL of these conditions“ dropdown and select Dates
  2. Below the input field saying “All Dates / Date Archives”, select a day, month and year and click Add. You can leave out e.g. day to target only month and year.
  3. That’s it, the sidebar will now be displayed on all posts published at the selected time!

 

Sidebar for all conditions above

You can combine several content types in a single condition group to target a very specific context. If you have followed all the examples above for the same sidebar, the conditions will now say: Display sidebar only if the visited webpage is a Post (and) with the selected Tags, (and) written by the selected Authors, and published at the selected Time.

 

 

We could keep adding conditions to this sidebar to target it even more, but you should now have a good idea how to take advantage of mixed conditions. Click here to read more about the currently supported conditions.

 

Tip: Adding conditions step by step is a good way to make sure the sidebar is displayed as expected. Content Aware Sidebars will not identify invalid/unreachable conditions.
Was this article helpful to you?