Description
Creating a Simple WordPress Plugin to display "Hello World!" on the frontend and has an admin page. The WordPress version used in this tutorial is 6.4.1 . The PHP version used in this example is 8.4.5 .
Creating a Simple WordPress Plugin to display "Hello World!" on the frontend and has an admin page. The WordPress version used in this tutorial is 6.4.1 . The PHP version used in this example is 8.4.5 .
<?php
/**
* Plugin Name: Simple Plugin by AEZ-Tech
* Plugin URI: https://www.aez-tech.site/how-to-create-wordpress-plugin/
* Description: Creating a Simple WordPress Plugin to display "Hello World!" on the frontend and has an admin page.
* Version: 1.0.0
* Author: AEZ-Tech
* Author URI: https://www.aez-tech.site
*/
// Prevent direct access to the file
if ( ! defined( 'ABSPATH' ) ) {
exit;}
// Displays "Hello World!" at the end of the content.
function AEZ_hello_world_display() {
echo '<p style="text-align: center; color: green; font-weight: bold;font-size: 30px;">
Hello World<br/>Simple Plugin by AEZ-Tech</p>;}
add_action( 'wp_footer', 'AEZ_hello_world_display' );
add_action( 'wp_body_open', 'AEZ_hello_world_display');
// Add a new top-level admin menu page.
function AEZ_hello_world_admin_menu() {
add_menu_page(
'Simple Plugin', // Page title
'Simple Plugin', // Menu title
'manage_options', // Capability required to access
'Simple-Plugin-by-AEZ-Tech', // Menu slug (unique identifier)
'AEZ_hello_world_settings_page_content', // Function to render the page content
'dashicons-smiley'// Icon URL or Dashicons class
);}
add_action( 'admin_menu', 'AEZ_hello_world_admin_menu' );
// Render the content of the admin settings page.
function AEZ_hello_world_settings_page_content() {
?>
<div class="wrap">
<h1>Simple Plugin Settings</h1>
<p style="text-align: center; color: blue; font-weight: bold; font-size: 30px;">
Hello World <br/> Simple Plugin by AEZ-Tech</p>
</div>
<?php
}