-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwpdublin.php
More file actions
130 lines (114 loc) · 4.28 KB
/
wpdublin.php
File metadata and controls
130 lines (114 loc) · 4.28 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
/*
Plugin Name: WordPress Dublin
Plugin URI: https://wpdublin.com/
Description: Set a primary category for your (custom) posts and query them in your template using native WordPress queries.
Author: Ciprian Popescu
Author URI: https://wpdublin.com/
Version: 1.0.3
Text Domain: wpdublin
WordPress Dublin
Copyright (C) 2018 Ciprian Popescu (getbutterfly@gmail.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('ABSPATH')) exit; // Exit if accessed directly
/**
* Include updater
*/
include 'classes/Updater.php';
/**
* Include recommendations
*/
include 'classes/class-tgm-plugin-activation.php';
if (is_admin()) {
$config = array(
'slug' => plugin_basename(__FILE__),
'proper_folder_name' => 'wpdublin',
'github_url' => 'https://github.com/getButterfly/wpdublin',
'requires' => '4.6',
'tested' => '4.9.4',
'readme' => 'readme.txt',
);
new WP_GitHub_Updater($config);
}
add_action('tgmpa_register', 'wpd_register_required_plugins');
function wpd_register_required_plugins() {
$plugins = array(
array(
'name' => 'WP Super Cache',
'slug' => 'wp-super-cache',
'required' => false,
),
array(
'name' => 'WP Sweep',
'slug' => 'wp-sweep',
'required' => false,
),
array(
'name' => 'WP Mail From II',
'slug' => 'wp-mailfrom-ii',
'required' => false,
),
array(
'name' => 'PHP Compatibility Checker',
'slug' => 'php-compatibility-checker',
'required' => false,
),
);
$config = array(
'id' => 'wpdublin', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'parent_slug' => 'plugins.php', // Parent menu slug.
'capability' => 'manage_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
'strings' => array(
'notice_can_install_recommended' => _n_noop(
/* translators: 1: plugin name(s). */
'WPDublin recommends the following plugin: %1$s.',
'WPDublin recommends the following plugins: %1$s.',
'tgmpa'
)
),
);
tgmpa($plugins, $config);
}
/**
* Include plugin settings
*/
include 'includes/wpd-functions.php';
include 'includes/wpd-settings.php';
/**
* Load dashboard styles
*/
function wpd_load_admin_style($hook) {
wp_enqueue_style('wpd', plugins_url('assets/css/dashboard.css', __FILE__));
}
add_action('admin_enqueue_scripts', 'wpd_load_admin_style');
/**
* Create plugin options menu
*/
function wpd_plugin_menu() {
add_menu_page(__('WPDublin', 'wp-primary-category'), __('WPDublin', 'wp-primary-category'), 'manage_options', 'wpd_settings', 'wpd_settings', 'dashicons-admin-tools', 4);
}
add_action('admin_menu', 'wpd_plugin_menu');
/**
* Add default/initial options
*/
function wpd_install() {
//add_option('wpd_primary_category', '');
}
register_activation_hook(__FILE__, 'wpd_install');