Can I change the layout of my protected WordPress categories?
The Password Protected Categories plugin restricts access to specific categories within your WordPress site, but it doesn’t change the layouts of these category pages. For example, if you’re using it to create a private blog then after unlocking the blog, people will still see the default layout.
Lots of people use Password Protected Categories to create hidden areas for specific types of visitor to their website. For example, you might use it to hide events, documents, blog posts or other information to people who are already familiar with your content. As a result, these users don’t want to see the standard layout with large images for each post.
You can create more suitable layouts by using Password Protected Categories with our other plugin, Posts Table Pro. Posts Table Pro lets you list any type of WordPress content (e.g. posts, pages or any custom post type) in a quick, searchable table layout:
There are 2 options for listing your protected WordPress content in a table with Posts Table Pro:
Option 1 – Add the table layout to your category page template
To add use the table layout on your category pages, you can add it to the archive template file in your theme. This will add the table layout throughout your store, replacing the default store layout on your main blog page and all your category pages. We’ve provided separate guidance on how to add tables to specific categories or post types only.
Option 2 – Create pages listing specific categories in a table
If you don’t want to edit template files, then here’s a non-technical alternative:
- Use Password Protected Categories to restrict access to specific categories, as required.
- On the Password Protected Categories settings page, ensure the plugin is configured to hide protected posts from public areas of your site.
- Create a new page (Pages → Add New) and add the following shortcode (depending on whether your protected categories are post categories, or categories for any other post type)
- Post categories –
[posts_table category="categoryslug"]. Replace
"categoryslug"with the correct slug for your protected category.
- Any other post type –
[posts_table term="taxonomyslug:categoryslug"]. Replace
"taxonomyslug:categoryslug"with the correct slug for the custom taxonomy that you are using for your categories, and the correct slug for the individual category you wish to list in the table. (For more guidance on this, please see the term option in Posts Table Pro.)
- Post categories –
This will list the posts from your protected category on the new page. The table will appear blank for users who do not have access to the protected category. The correct posts will be listed in the table for people who have unlocked the protected category.