2
2
3
3
This is a simple plugin used to load the latest ** _ release_ ** version of [ Carbon Fields] ( http://carbonfields.net/ ) .
4
4
5
- This plugin is ** not** officially supported by htmlBurger, the makers of Carbon Fields.
5
+ This plugin is ** not** supported by [ htmlBurger] ( https://htmlburger.com ) , the makers of Carbon Fields.
6
6
7
7
** What is the point?** None really, unless you want to run a different version of Carbon Fields than what is on the wordpress.org repo.
8
8
@@ -15,19 +15,19 @@ I'm not going to do a release until this thing isn't terrible.
15
15
(I haven't actually tested this yet - I just created this repo.)
16
16
17
17
* WordPress 4.0 or higher
18
- * PHP 5.3.29 or higher
18
+ * PHP 5.3 or higher
19
19
20
20
## How do I use it correctly with my plugin/theme?
21
21
22
22
If you want to use this plugin to load Carbon Fields for use with your plugin or theme, you would probably want to do something like this:
23
23
24
24
```
25
- function load_my_magic () {
26
- // Do something swell
25
+ function do_plugin_logic () {
26
+ // Load plugin logic
27
27
}
28
28
29
29
add_action( 'plugins_loaded', array( 'Carbon_Fields\\Carbon_Fields', 'boot' ) );
30
- add_action( 'carbon_fields_loaded', 'load_my_magic ' );
30
+ add_action( 'carbon_fields_loaded', 'do_plugin_logic ' );
31
31
```
32
32
33
33
## Version Checking
@@ -37,13 +37,6 @@ Since it is possible that an older version of the plugin may be installed and/or
37
37
** Quick example:**
38
38
39
39
```
40
- add_action( 'plugins_loaded', array( 'Carbon_Fields\\Carbon_Fields', 'boot' ) );
41
- add_action( 'carbon_fields_loaded', 'load_my_magic' );
42
-
43
- if(verify_dependencies(['carbon_fields' => '2.0.0'])) {
44
- // Execute my super-awesome plugin logic
45
- }
46
-
47
40
function verify_dependencies( $deps ) {
48
41
// Check if outdated version of Carbon Fields loaded
49
42
$error = false;
@@ -64,6 +57,15 @@ function verify_dependencies( $deps ) {
64
57
65
58
return !$error;
66
59
}
60
+
61
+ function do_plugin_logic() {
62
+ if(verify_dependencies(['carbon_fields' => '2.0.0'])) {
63
+ // Load plugin logic
64
+ }
65
+ }
66
+
67
+ add_action( 'plugins_loaded', array( 'Carbon_Fields\\Carbon_Fields', 'boot' ) );
68
+ add_action( 'carbon_fields_loaded', 'do_plugin_logic' );
67
69
```
68
70
69
71
## Frequently Asked Questions
0 commit comments