All the pages in WP Customer Area are built on the same foundation and share a lot of common features and behaviours. On top of these, pages can be grouped by type which expose more specific features. As a developer, it is important to know the different types of pages when it comes to changing their behaviour or appearance. Below you will find a reference about the page types used in WP Customer Area.
Tip: you can find the type of a page in the Customer Area > Status > Pages developer tool.
Basic Page
This is the default type page. It forms the basis for types that will use the same model:
{$slug-header.template.php}
{$slug-content.template.php}
{$slug-footer.template.php}
{$slug-sidebar.template.php}
(if the presence of a sidebar)
Redirect page
Redirect pages are mainly used to provide a hierarchy in the navigation menu. Their mission is to redirect to another page of the front office.
For example, the Files redirects by default to My files. Another example is the main page of WP Customer Area that redirects to the user’s dashboard.
Of course, you can redirect to another page than the default one by implementing a filter. We have a code snippet which allows you to change the default page shown by the Customer Area and it can be applied to all pages of this type.
Content listing page
Those pages are meant to list private content for users. Be it private files, private pages or conversations, they mostly all behave in the same way.
If content is available
Just like any basic page, the content will be generated using the {$slug-content.template.php}
templates which itself will use the template {$slug}-content-item-{$display_mode}.template.php
where $display_mode
is either:
date_archive
to display year/month archivecategory_archive
to display a category archivedefault
for the general case
If this template does not exist, {$slug}-content-item.template.php
will be used instead.
If no content is available
In that case, and similarly to what we saw above, the {$slug}-content-empty-{$display_mode}.template.php
template will be used (or {$slug}-content-empty.template.php
).
Content listing on the dashboard
Additionally, these pages have a setting to enable listing recent content in the dashboard page. Once this setting is enabled, the most recent content is retrieved and displayed using the template named {$slug}-content-item-dashboard.template.php
, or {$slug}-content-item.template.php
if the former does not exist.
If no content is available for the dashboard, models {$slug}-content-empty-dashboard.template.php
or {$slug}-content-empty.template php
are used.
Database queries
To fetch the content to be displayed, those pages use the WP_Query
class. The parameters of this query can be modified by using one of these filters:
cuar/core/page/query-args?slug={$slug}
cuar/core/page/query-args?slug={$slug}&display_mode={$display_mode}
The filter has a single argument: the parameter table to build the WP_Query
. Similarly, for the dashboard, you can use the filter: cuar/core/dashboard/block-query-args?slug={$slug}
.
A code snippet shows you how to modify the queries for private content listing.
Content creation page
Add-ons like conversations and front-office publishing enable the creation of content directly from the front office. The pages that allow to create content are similar in behaviour. These pages offer actions to perfom tasks before and after content creation. You can plug your own code using the WordPress actions named:
cuar/private-content/edit/before_create
cuar/private-content/edit/after_create
cuar/private-content/edit/before_update
cuar/private-content/edit/after_update
cuar/private-content/edit/before_create?slug={$slug}
cuar/private-content/edit/after_create?slug={$slug}
cuar/private-content/edit/before_update?slug={$slug}
cuar/private-content/edit/after_update?slug={$slug}