Files
Wordpress-Snippets/Backend/backend-page/index.php
2024-11-21 09:00:55 +00:00

30 lines
1.2 KiB
PHP

<?php
// Hook to admin_menu to add a custom menu page
function custom_dashboard_page() {
add_menu_page(
'Theme Settings', // Page title
'Local Content Pro', // Menu title
'manage_options', // Capability (who can access this menu)
'custom-dashboard', // Menu slug
'custom_dashboard_content', // Function to render the page content
'dashicons-admin-home', // Icon (using a Dashicon)
58 // Position in the admin menu (optional)
);
}
add_action( 'admin_menu', 'custom_dashboard_page' );
// Function to render the custom page content
function custom_dashboard_content() {
?>
<div class="wrap">
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
<p>Welcome to the custom dashboard page. Here you can add your custom content.</p>
<p>For example, add a form, data, or other custom information.</p>
<form method="post" action="">
<input type="text" name="custom_field" placeholder="Enter something" />
<input type="submit" value="Submit" />
</form>
</div>
<?php
}