-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbeans-simple-edits.php
More file actions
96 lines (86 loc) · 2.66 KB
/
beans-simple-edits.php
File metadata and controls
96 lines (86 loc) · 2.66 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
<?php
/**
* Loads the Beans Simple Edits Plugin
*
* @package LearningCurve\BeansSimpleEdits
* @since 1.0
* @author Jeff Cleverley
* @link https://learningcurve.xyz
* @license GNU-2.0+
*
* @wordpress-plugin
* Plugin Name: Beans Simple Edits
* Plugin URI: http://github.com/JeffCleverley/BeansSimpleEdits
* Description: Beans Simple Edits lets you edit three commonly modified areas in any Beans Child theme: the post-info, the post-meta, and the footer area.
* Version: 1.0
* Author: Jeff Cleverley
* Author URI: https://learningcurve.xyz
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: beans-simple-edits
* Requires WP: 4.6
* Requires PHP: 5.6
*/
/**
* Special thanks to:
*
* This plugin was inspired by StudioPress's Genesis Simple Edits Plugin, one of the most popular plugins for Genesis Developers and Implementors.
* Standing on the shoulders of these Giants of Development:
* StudioPress, Nathan Rice, and Ron Rennick - Thank you so much!
*
* Genesis Simple Edit WordPress Org Links:
* - https://wordpress.org/plugins/genesis-simple-edits/
* - https://profiles.wordpress.org/studiopress
* - https://profiles.wordpress.org/nathanrice
* - https://profiles.wordpress.org/wpmuguru
*/
namespace LearningCurve\BeansSimpleEdits;
if ( ! defined( 'ABSPATH' ) ) {
exit( 'Hello, Hello, Hello, what\'s going on here then?' );
}
register_activation_hook( __FILE__, __NAMESPACE__ . '\deactivate_when_beans_not_activated_theme' );
add_action( 'switch_theme', __NAMESPACE__ . '\deactivate_when_beans_not_activated_theme' );
/**
* If Beans is not the activated theme, deactivate this plugin and pop a die message when not switching themes.
*
* @since 1.0
*
* @return void
*/
function deactivate_when_beans_not_activated_theme() {
// If Beans is the active theme, bail out.
$theme = wp_get_theme();
if ( in_array( $theme->template, array( 'beans', 'tm-beans' ), true ) ) {
return;
}
deactivate_plugins( plugin_basename( __FILE__ ) );
if ( current_filter() !== 'switch_theme' ) {
$message = __( 'Sorry, you can\'t activate this plugin unless the <a href="https://www.getbeans.io" target="_blank">Beans</a> framework is installed and a child theme is activated.', 'beans-visual-hook-guide' );
wp_die( wp_kses_post( $message ) );
}
}
/**
* Autoload the plugin's files.
*
* @since 1.0
*
* @return void
*/
function autoload_files() {
$files = array(
'class-beans-simple-edits.php',
);
foreach ( $files as $file ) {
require __DIR__ . '/src/' . $file;
}
}
/**
* Launch the plugin.
*
* @since 1.0
*
* @return void
*/
function launch() {
autoload_files();
}
launch();