Skip to content

Commit 64b5cc7

Browse files
authored
Merge pull request #18 from felipelousantos/notes
New Notes feature for displaying a message when applying the Presets Bump for version 1.0.0
2 parents 6544eee + 73ab619 commit 64b5cc7

File tree

7 files changed

+54
-4
lines changed

7 files changed

+54
-4
lines changed

modules/modules.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<?php
22

33
require_once plugin_dir_path( __FILE__ ) . 'woocommerce/module.php';
4+
require_once plugin_dir_path( __FILE__ ) . 'notes/module.php';
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
function presets_modules_notes_general_settings_actions() {
4+
5+
$prefix = 'modules_notes_general_settings_';
6+
7+
$preset_id = filter_var( $_GET['presets-applied'], FILTER_SANITIZE_NUMBER_INT );
8+
9+
echo wpautop( get_post_meta( $preset_id, 'presets_' . $prefix . 'notes', true ) );
10+
11+
}
12+
13+
add_action( 'presets_admin_notice_sucess', 'presets_modules_notes_general_settings_actions' );
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
function presets_modules_notes_general_settings_metabox() {
4+
5+
$prefix_meta = 'presets_modules_notes_general_settings_';
6+
7+
/**
8+
* Initiate the metabox
9+
*/
10+
$cmb = new_cmb2_box(
11+
array(
12+
'id' => $prefix_meta . 'metabox',
13+
'title' => __( 'Notes', 'presets' ),
14+
'object_types' => array( 'presets' ), // Post type
15+
'context' => 'normal',
16+
'priority' => 'low',
17+
'show_names' => true, // Show field names on the left
18+
)
19+
);
20+
21+
$cmb->add_field(
22+
array(
23+
'name' => __( 'Notes', 'notes' ),
24+
'id' => $prefix_meta . 'notes',
25+
'type' => 'wysiwyg',
26+
)
27+
);
28+
29+
}
30+
31+
add_action( 'presets_create_metabox', 'presets_modules_notes_general_settings_metabox' );

modules/notes/module.php

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
3+
require_once plugin_dir_path( __FILE__ ) . 'fields/general-settings.php';
4+
require_once plugin_dir_path( __FILE__ ) . 'actions/general-settings.php';

presets.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Author: Presets contributors
66
* Author URI: https://github.com/felipelousantos/wp-presets/graphs/contributors
77
* Text Domain: presets
8-
* Version: 0.3.0
8+
* Version: 1.0.0
99
*
1010
* @package Presets
1111
*/

readme.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Contributors: allysonsouza, felipeloureirosantos
33
Tags: tests, debug
44
Requires at least: 5.0
5-
Tested up to: 5.7
5+
Tested up to: 5.8
66
Requires PHP: 7.0
7-
Stable tag: 0.3.0
7+
Stable tag: 1.0.0
88
License: GPLv2 or later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1010

src/actions/apply-presets.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ function presets_admin_notice__success() {
7171

7272
?>
7373
<div class="notice notice-success is-dismissible">
74-
<p><?php _e( 'The settings were applied as expected! ' ); ?></p>
74+
<p><?php _e( 'The settings were applied as expected! ' ); ?></p>
75+
<?php do_action( 'presets_admin_notice_sucess' ); ?>
7576
</div>
7677
<?php
7778
}

0 commit comments

Comments
 (0)