Admin Page
The Admin_Page class registers custom submenu pages under the Terra admin menu. Each page renders a PHP template file, giving you full control over the admin UI for custom tools, dashboards, or internal documentation.
Parameters
Section titled โParametersโ- page_title (string): Title shown in the browser tab and at the top of the page.
- menu_title (string): Label shown in the admin sidebar menu (defaults to
page_title). - menu_slug (string): URL slug for the page.
- capability (string): Required WordPress capability (default:
'edit_posts'). - parent_slug (string): Parent menu slug (default:
'terra_dashboard'). - template (string): Path to the PHP template file, relative to the theme root.
Configuration File
Section titled โConfiguration Fileโfunctions/project/config/admin-pages_config.php
<?phpreturn [ [ 'page_title' => 'Client Documentation', 'menu_title' => 'Client Docs', 'menu_slug' => 'client_documentation', 'capability' => 'edit_posts', 'template' => 'functions/project/admin-pages/client-documentation.php', ], [ 'page_title' => 'CSV Import', 'menu_title' => 'CSV Import', 'menu_slug' => 'csv_import', 'capability' => 'manage_options', 'template' => 'functions/project/admin-pages/csv-import.php', ],];Template File
Section titled โTemplate FileโCreate your template in functions/project/admin-pages/:
<?php?><div class="wrap"> <h1>Client Documentation</h1> <p>Here you'll find guides on how to manage your website content.</p>
<h2>How to add a new Resource</h2> <ol> <li>Go to <strong>Resources > Add New</strong></li> <li>Fill in the title and content</li> <li>Select a category and type</li> <li>Click <strong>Publish</strong></li> </ol></div>Knowledge Check
Test your understanding of this section
Loading questions...