Admin Pages

This extension allows you to create admin pages using Bricks Templates. Admin Pages are custom menu items that can be added to the WordPress admin menu. They can be used to create custom dashboards, settings pages, or any other type of admin page.

How to use

First, you need to activate the extension under the Bricksforge > Extensions menu. Once activated, you will see a new sidebar menu item called Admin Pages. Click on it to create your first admin page.

Settings

For each Admin Page, you can set the following options:

SettingDescription
Admin Page NameThe name of the admin page that will be displayed in the admin menu.
PermissionThe permission required to see and access the admin page. You can choose between different user roles. For example, if you want to create a settings page that only administrators can access, you can set the permission to Administrator.
Bricks Page/TemplateThe Bricks Page or Template that will be used to render the admin page. You can choose between all the pages and templates that you have created in Bricks.
Open Link BehaviorHow should links inside admin pages be opened?. You can choose between Same Frame and Parent. For example, if you want to open links in a new tab, you can set the behavior to Parent.
TypeYou can choose between Top Level Page and Sub Menu Page. If you choose Top Level Page, the admin page will be added to the top level of the admin menu. If you choose Sub Menu Page, the admin page will be added as a sub menu item.
Parent PageIf you choose Sub Menu Page as the type, you can select the parent page here. This field expects the slug of the parent page, for example: brf-ap-new-admin-page.
Menu PositionThe position of the admin page in the admin menu.
IconThe icon that will be displayed in the admin menu. You can choose between all the icons that are available in WordPress. For example, if you want to use the WordPress logo, you can set the icon to dashicons-wordpress.

You can add as many admin pages as you want. To remove an admin page, simply click on the Remove Admin Page button.

Developer API

When a Bricks template is rendered inside an Admin Page, Bricksforge provides a PHP constant and a helper function to detect this context. This is useful if you need to enqueue custom scripts or styles specifically for the Admin Page canvas (e.g. via WPCodeBox or custom plugin code).

BRICKSFORGE_ADMIN_PAGE_CANVAS

PHP constant, set to true when the current request is rendering inside the Admin Page canvas. Not defined on regular frontend or admin requests.

if (defined('BRICKSFORGE_ADMIN_PAGE_CANVAS') && BRICKSFORGE_ADMIN_PAGE_CANVAS) {
    // runs only inside the Admin Page canvas
}

bricksforge_is_admin_page_canvas()

Helper function that returns true when inside the Admin Page canvas, false otherwise.

if (function_exists('bricksforge_is_admin_page_canvas') && bricksforge_is_admin_page_canvas()) {
    wp_enqueue_style('my-admin-page-styles', '...');
    wp_enqueue_script('my-admin-page-scripts', '...');
}

Pro Forms

Pro Forms actions like Reload and Redirect work inside Admin Pages out of the box. Navigation actions automatically target the parent page instead of staying trapped in the canvas.