An Article by www.hostgator.com
Video Tuts Series by Online Web Tutor - Nov 7, 2017
Video Tuts Series by Online Web Tutor - Oct 26, 2018
Video Tuts Series- Nov 10, 2017
Video Tuts Series by Smart Coder - Oct 3, 2017
Video Tuts series by Robiz show - Feb 28, 2020
Video Tuts series by Tareq Hasan - Mar 1, 2020
Video Tuts Series by Imran Sayed - Nov 4, 2017
by craigedmonds | 18 Apr, 2020
(Including Personal Options, Biographical Info, Website etc.) and titles without JS
wordpress.stackexchange.com/questions/110895/adding-custom-stylesheet-to-wp-admin
To get started creating a new plugin, follow the steps below.
you’ll need to add a plugin header comment. This is a specially formatted PHP block comment that contains metadata about the plugin, such as its name, author, version, license, etc. The plugin header comment must comply with the header requirements, and at the very least, contain the name of the plugin.
<?php /** * Plugin Name: YOUR PLUGIN NAME */
<?php /** * Plugin Name: My Basics Plugin * Plugin URI: https://example.com/plugins/the-basics/ * Description: Handle the basics with this plugin. * Version: 1.10.3 * Requires at least: 5.2 * Requires PHP: 7.2 * Author: John Smith * Author URI: https://author.example.com/ * License: GPL v2 or later * License URI: https://www.gnu.org/licenses/gpl-2.0.html * Text Domain: my-basics-plugin * Domain Path: /languages */
register_activation_hook( __FILE__, 'pluginprefix_function_to_run' );
register_deactivation_hook( __FILE__, 'pluginprefix_function_to_run' );
The first parameter in each of these functions refers to your main plugin file, which is the file in which you have placed the plugin header comment. Usually these two functions will be triggered from within the main plugin file; however, if the functions are placed in any other file, you must update the first parameter to correctly point to the main plugin file.
Video Tuts series by Online Web Tutor - Dec 30, 2018
// WP_Query which displays posts from movies category: $the_query = new WP_Query( 'category_name=movies' ); // The Loop if ( $the_query->have_posts() ) { echo '<ul>'; while ( $the_query->have_posts() ) { $the_query->the_post(); echo '<li>' . get_the_title() . '</li>'; } echo '</ul>'; } else { // no posts found } /* Restore original Post Data */ wp_reset_postdata();
add_menu_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '', string $icon_url = '', int $position = null )
page_title: The title of the page. menu_title: Menu title that will be displayed on the dashboard. capability: Minimum capability to view the menu. menu_slug: Unique name used for the menu item. function: Used to display page content. icon_url: URL to custom image used as an icon. position: Location in the menu order.
This function takes a capability which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required capability as well.
(string) (Required) The text to be displayed in the title tags of the page when the menu is selected.
(string) (Required) The text to be used for the menu.
(string) (Required) The capability required for this menu to be displayed to the user.
(string) (Required) The slug name to refer to this menu by. Should be unique for this menu page and only include lowercase alphanumeric, dashes, and underscores characters to be compatible with sanitize_key().
(callable) (Optional) The function to be called to output the content for this page.
Default value: ''
(string)
(Optional)
The URL to the icon to be used for this menu.
* Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme. This should begin with 'data:image/svg+xml;base64,'.
* Pass the name of a Dashicons helper class to use a font icon, e.g. 'dashicons-chart-pie'.
* Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS.
Default value: ''
(int) (Optional) The position in the menu order this one should appear.
Default value: null
To add an administration menu, you must do three things:
It is that second step that is often overlooked by new developers. You cannot simply call the menu code described; you must put it inside a function, and then register the function.
add_submenu_page( string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, callable $function = '' )
Slugs for $parent_slug (first parameter)
Dashboard: ‘index.php’
Posts: ‘edit.php’
Media: ‘upload.php’
Pages: ‘edit.php?post_type=page’
Comments: ‘edit-comments.php’
Custom Post Types: ‘edit.php?post_type=your_post_type’
Appearance: ‘themes.php’
Plugins: ‘plugins.php’
Users: ‘users.php’
Tools: ‘tools.php’
Settings: ‘options-general.php’
Network Settings: ‘settings.php’
If you want to add a submenu type to a custom post type, such as a reference page for a custom post type created by a plugin, you can use for the $parent_slug parameter whatever you see up top on the “All Posts” view for that post type. For instance, for a custom post type “Book,” the $parent_slug could be 'edit.php?post_type=book'.
/** * Adds a submenu page under a custom post type parent. */ function books_register_ref_page() { add_submenu_page( 'edit.php?post_type=book', __( 'Books Shortcode Reference', 'textdomain' ), __( 'Shortcode Reference', 'textdomain' ), 'manage_options', 'books-shortcode-ref', 'books_ref_page_callback' ); } /** * Display callback for the submenu page. */ function books_ref_page_callback() { ?> <div class="wrap"> <h1><?php _e( 'Books Shortcode Reference', 'textdomain' ); ?></h1> <p><?php _e( 'Helpful stuff here', 'textdomain' ); ?></p> </div> <?php }
/** * Sub menu class */ class Sub_menu { /** * Autoload method * @return void */ public function __construct() { add_action( 'admin_menu', array(&$this, 'register_sub_menu') ); } /** * Register submenu * @return void */ public function register_sub_menu() { add_submenu_page( 'options-general.php', 'Submenu title', 'Submenu title', 'manage_options', 'submenu-page', array(&$this, 'submenu_page_callback') ); } /** * Render submenu * @return void */ public function submenu_page_callback() { echo '<div class="wrap">'; echo '<h2>Submenu title</h2>'; echo '</div>'; } } new Sub_menu();
Video Tuts by Imran Sayed - Oct 21, 2017
//absolute path to wp-load.php, or relative to this script //e.g., ../wp-core/wp-load.php include( 'trunk/wp-load.php' ); //grab the WPDB database object, using WP's database //more info: http://codex.wordpress.org/Class_Reference/wpdb global $wpdb; //make a new DB object using a different database //$mydb = new wpdb('username','password','database','localhost'); //basic functionality //run any query $wpdb->query( "SELECT * FROM wp_posts" ); //run a query and get the results as an associative array $wpdb->get_results( "SELECT * FROM wp_posts" ); //get a single variable $wpdb->get_var( "SELECT post_title FROM wp_posts WHERE ID = 1" ); //get a row as an assoc. array $wpdb->get_row( "SELECT * FROM wp_posts WHERE ID = 1" ); //get an entire column $wpdb->get_col( "SELECT post_title FROM wp_posts" );
Video Tuts Series by Online Web Tutor - Oct 7, 2018
Video Tuts by Artisans Web - Jan 5, 2015
Video Tuts Series by Online Web Tutor - Jun 15, 2018
Video Tuts by LearnWebCode - Dec 15 - 2016
Video Tuts by Code With Mehedi - Apr 28, 2020