-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy-cool-plugin.php
More file actions
74 lines (64 loc) · 2.64 KB
/
my-cool-plugin.php
File metadata and controls
74 lines (64 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
* Project Zero Plugin
* @package WordPress
* @subpackage Project_Zero
*
* Plugin Name: Avandra (Project Zero Plugin)
* Plugin URI: https://github.com/{USER-NAME}/{REPO-NAME}/
* Description: A blank plugin developed for budding WordPress plugin developers. You can use this as a starting point for all of your plugins. The plugin goes under the name of "Avandra", after the Changebringer deity from Dungeons and Dragons. She has been used in the liveplay stream Critical Role and is the Goddess of freedom, adventure, and luck. Since plugins allow you the freedom to build your WordPress site as you see fit, it seems like she would be the best deity to name this plugin after.
* Version: 0.1
* Requires at least: 5.0
* Tested up to: 6.1.1
* Requires PHP: 7.4
* License: General Public License v3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Author: Nathan Hawkes
* Author URI: https://www.nathanhawkes.co.uk/
* Text Domain: {REPO-NAME}
*/
// Call Plugin Update Checker
require plugin_dir_path( __FILE__ ) . 'updater/ptuc/plugin-update-checker.php';
// Check for updates to theme
use YahnisElsts\PluginUpdateChecker\v5p0\PucFactory;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Set constants
*/
define( 'ZEROPLUGIN_DIR', __FILE__ );
define( 'ZEROPLUGIN_PATH', plugin_dir_path( ZEROPLUGIN_DIR ) );
define( 'ZEROPLUGIN_URL', plugins_url( '/', ZEROPLUGIN_DIR ) );
/**
* Call init.php
*/
include_once plugin_dir_path( ZEROPLUGIN_DIR ) . 'init.php';
/**
* Plugin Update script (fired on is_admin only)
*/
if ( is_admin() ){
if( !function_exists('get_plugin_data') ){
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
$zeroplugin = get_plugin_data( ZEROPLUGIN_DIR );
$checkPlugin = PucFactory::buildUpdateChecker(
$zeroplugin['PluginURI'],
ZEROPLUGIN_DIR,
$zeroplugin['TextDomain']
);
// Enables releases via GitHub
// $checkPlugin->getVcsApi()->enableReleaseAssets();
$checkPlugin->addResultFilter( function( $info, $response = null ) {
// Add icons for Dashboard > Updates screen.
$info->icons = array(
'1x' => plugins_url( '/assets/icon-128x128.png', ZEROPLUGIN_DIR ),
'2x' => plugins_url( '/assets/icon-256x256.png', ZEROPLUGIN_DIR ),
);
$info->banners = array(
'low' => plugins_url( '/assets/banner-772x250.png', ZEROPLUGIN_DIR ),
'high' => plugins_url( '/assets/banner-1544x500.png', ZEROPLUGIN_DIR ),
);
return $info;
});
}