Search
 
SCRIPT & CODE EXAMPLE
 

PHP

create a wp plugin

<?php 
/*
 * Plugin Name: Custom-Plugin
 * Plugin URI: 
 * Description: Test Page. 
 * Version: 0.0.1
 * Author:
 * Author URI: 
 */

add_action('admin_menu', 'function_create_menu');
// Create WordPress admin menu
function function_create_menu(){

//The icon in Base64 format
$icon_base64 = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAyMTM0IDIxMzQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgeG1sbnM6c2VyaWY9Imh0dHA6Ly93d3cuc2VyaWYuY29tLyIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjU7Ij48Zz48cmVjdCB4PSIyODIuNTc2IiB5PSI4OTAuODg2IiB3aWR0aD0iNzc1Ljc1OCIgaGVpZ2h0PSI3NzguNzgxIiBzdHlsZT0iZmlsbDojZmZmO2ZpbGwtb3BhY2l0eTowO3N0cm9rZTojMDAxZGZmO3N0cm9rZS13aWR0aDo2Ni42N3B4OyIvPjxyZWN0IHg9IjEwNzMuODkiIHk9Ijg5MC44ODYiIHdpZHRoPSI3NzUuNzU4IiBoZWl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D0iMTc3OC42MSIgeT0iMTgxMy43IiB3aWR0aD0iMTQyLjQxMiIgaGVpZ2h0PSIxNDEuNDc5IiBzdHlsZT0iZmlsbDpub25lO3N0cm9rZTojMDAxZGZmO3N0cm9rZS13aWR0aDo2Ni42N3B4OyIvPjwvZz48L3N2Zz4=';

//The icon in the data URI scheme
$icon_data_uri = 'data:image/svg+xml;base64,' . $icon_base64;

$page_title = 'Hello World';
$menu_title = 'My Admin Menu';
$icon_data_uri;
$position   = '20';
$capability = 'manage_options';
$menu_slug  = 'newPage';
$function   = 'test_page';

add_menu_page(
    $page_title,
    $menu_title,
    $capability,
    $menu_slug,
    $function,
    $icon_data_uri,
    $position
);

}

// Create WordPress plugin page
function test_page()
{
?>
<h1>WordPress test site</h1>

<?php
}

?>
Comment

wp plugin create

<?php
/**
 * Plugin Name:   My Plugin
 * Description:   A plugin
 * Version:       1.1.1.0
 * Author:        E.Bisco
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly the file

// code snippet below
Comment

create plugin wordpress

1
2
3
4
5
6
sept
8
9
dix
11
12
13
14
15
16
17
18
19
/**
 * Register the "book" custom post type
 */
function pluginprefix_setup_post_type() {
    register_post_type( 'book', ['public' => true ] ); 
} 
add_action( 'init', 'pluginprefix_setup_post_type' );
 
 
/**
 * Activate the plugin.
 */
function pluginprefix_activate() { 
    // Trigger our function that registers the custom post type plugin.
    pluginprefix_setup_post_type(); 
    // Clear the permalinks after the post type has been registered.
    flush_rewrite_rules(); 
}
register_activation_hook( __FILE__, 'pluginprefix_activate' );
Comment

PREVIOUS NEXT
Code Example
Php :: get month first date and last date in php 
Php :: laravel access JsonResponse content 
Php :: laravel get all session data 
Php :: Notice: Trying to access array offset on value of type int in /var/www/pdam/modules/phpexcel/PHPExcel/Cell/DefaultValueBinder.php on line 82 
Php :: execute specific migration laravel 
Php :: A non well formed numeric value encountered 
Php :: laravel iteration 
Php :: unset session key 
Php :: how get the Photo size upload in laravel 
Php :: how to prompt user for input in php 
Php :: php switch statement 
Php :: php return json data 
Php :: PHP not working centos 8 
Php :: random string generator php 
Php :: how to retrieve data from database using select option in laravel 
Php :: laravel change foreign key name 
Php :: laravel deleted controller still cached 
Php :: How to reset phpmyadmin username and password 
Php :: validator and custom error laravel 8 
Php :: change key value laravel map collection 
Php :: convert date to timestamp in laravel builder 
Php :: how to collapse array in laravel 
Php :: laravel event generate 
Php :: twig for loop key 
Php :: phpmyadmin reset auto_increment 
Php :: genrate file name in php 
Php :: laravel pass variables to view 
Php :: get array length using php 
Php :: php random characters 
Php :: email configuration for gmail in laravel 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =