Location settings are only available for global blocks. Local blocks are “local” and are added directly to the page, post, or custom post type you are are working on. So setting the location would be a bit redundant. Global blocks allow you to add content to any webpage and any number of webpages. Therefore, we need to configure the location settings. Block location is available for both Blox and Blox Lite.
Global blocks are shown on all pages by default. Alternatively, you can choose between the following options:
- Show on Selected – Show the content block on all pages that meet the select criteria
- Hide on Selected – Hide the content block on all pages that meet the select criteria
Once a selection type has been chosen, a new pane of settings will appear:
- Front Page – The homepage of your website
- Posts Page – The blog page, or posts archive page (could also be your homepage)
- Single Pages – Any singular webpage including posts, pages, and any public custom post type
- Archive Pages – Any archive page (excluding search archives)
- Search Pages – Any search page or search archive
- 404 Error Page – The 404 error page of your website
Depending on the test you chose, check the pages you would like the content block to be shown or hidden on. Single Pages and Archive Pages have additional settings that will appear once these options are checked. See the screenshot below.
If you have checked Single Pages, you will be presented with a dropdown. You can then choose between all single pages or a selection. Choosing All Single Pages will show (or hide) the content block on any singular page. This includes pages, posts, media pages, and public custom post types. For developers, this is any time
is_singular() returns true. Choosing Selected Single Pages presents a new pane of options. See the screenshot below.
From the new pane of options, you can choose the type(s) of single pages you want the content block to show (or hide) on. You will notice that if any custom post types are found, they will be denoted as such.
Checking a single page type will present you with a new pane of options that corresponds to that page type. For demo purposes we are just going to focus on Posts, but the following translates to other page types as well. Similar to before you will be presented with a dropdown from which you can select:
- All Post – Show (or hide) the content block on all posts
- Selected Posts – Show (or hide) the content block on selected posts
- Selected Posts by Taxonomies – Show (or hide) the content block on selected posts determined by the post’s taxonomies (categories, tags, etc.)
- Selected Posts by Authors – Show (or hide) the content block on selected posts determined by the post’s author
This option is very straight forwards. Simply choose the posts you want the block to show (or hide) on and you are done! See the screenshot below.
Selected Posts By Taxonomies
Now not all page types have taxonomies, but many do. Since we are looking at Posts in this demo, posts come standard in WordPress with the Categories and Tags taxonomies. So when you choose Selected Posts by Taxonomies, you will be presented with a pane similar to the one below. If you have added any additional custom taxonomies, those will show up as well.
Taxonomies can get a bit tricky because a single page type can have multiple taxonomies. In this case, posts can have both Categories and Tags. Single page types can also have multiple taxonomy terms. As we can see in our demo, a post can be apart of multiple categories and also have tags.
To target the desired location effectively, a taxonomy test is needed and thus we have the setting Test Strength. When running a taxonomy test, you need to determine how all of the different taxonomies and taxonomy terms effect the location of the content block. Test strength is broken into three categories:
- Loose – A loose test means that the block will show/hide so long as it has any of the selected taxonomy terms
- Strict – A strict test will only show/hide the block if it has all the selected taxonomy terms.
- Binding – A binding test will only show/hide the block if it has all and only the selected taxonomy terms.
It is important to note that the taxonomy test takes into account terms across all included taxonomies. Ignored taxonomies are not included in the test.
Taxonomy Test Example
Take a look at the screenshot above and lets assume we are using Show on Selected. You will notice that we are running a Loose test, we are choosing selected Categories, and Tags have been ignored. Due to the Loose test, the content will show on any post that has any of the checked categories. It could have all of the checked categories, or only one, and the block would still show. Since Tags have been ignored, they play no role in determining location.
Now lets assume the the test had been changed to Strict. In this case, the block would only show on posts that have both the categories Drawing and Photo. A post could have additional categories, but so long as it has both Drawing and Photo, the block will show. Again Tags play no role.
If the test was switched to Binding, the block would only display on post that had Drawing and Photo and no other categories. Again Tags play no role because they have been ignored.
Selected Posts by Author
You can also select posts by who wrote them. With the Selected Posts by Authors option, you are presented with with checkboxes for each author on your site. Simply check the ones whose posts you want to show (or hide) the content block and you are done. Each author is indicated by the number of posts they have written. See the screenshot below.
If you have checked Archive Pages, you will be presented with a dropdown. You can then choose between all archive pages or a selection. Choosing All Archive Pages will show (or hide) the content block on any archive page. This includes post archives, category pages, author archives, custom taxonomy archives, etc. For developers, this is any time
is_archive() returns true. Choosing Selected Archive Pages presents a new pane of options. See the screenshot below.
From the new pane of options, you can choose the type(s) of archive pages you want the content block to show (or hide) on. You will notice that each type of archive page is denoted by the post type they correspond to. The screenshot, we have the traditional post archive types, but also ones for download and easy_docs. These are two custom post types that were installed on this website.
Check the archive types you want and a new pane of options will appear. Again you can choose to show on all archive of the given type, or a selection. The screenshot below depicts a selection of Tags archives.
With the block’s location set, it is now time to set the visibility.