@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * @param int $post_id |
|
| 71 | - */ |
|
| 69 | + /** |
|
| 70 | + * @param int $post_id |
|
| 71 | + */ |
|
| 72 | 72 | public function save_post( $post_id ) { |
| 73 | 73 | |
| 74 | 74 | $sidebar_id = filter_input( INPUT_POST, 'custom-sidebar-select', FILTER_VALIDATE_INT ); |
| 75 | - $custom_sidebar = filter_input( INPUT_POST, 'custom-sidebar', FILTER_VALIDATE_BOOLEAN ); |
|
| 75 | + $custom_sidebar = filter_input( INPUT_POST, 'custom-sidebar', FILTER_VALIDATE_BOOLEAN ); |
|
| 76 | 76 | |
| 77 | 77 | if ( isset( $custom_sidebar ) ) { |
| 78 | 78 | $sidebar_id = Custom_Sidebars::get_sidebar_id( $post_id ); |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * @param int|null $post_id |
|
| 88 | - * @return bool |
|
| 89 | - */ |
|
| 86 | + /** |
|
| 87 | + * @param int|null $post_id |
|
| 88 | + * @return bool |
|
| 89 | + */ |
|
| 90 | 90 | public static function has_custom_sidebar( $post_id = null ) { |
| 91 | 91 | |
| 92 | 92 | $value = false; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function render() { |
| 53 | 53 | |
| 54 | 54 | $metabox = $this; |
| 55 | - include dirname( __DIR__ ) . '/templates/custom-sidebar-details.php'; |
|
| 55 | + include dirname( __DIR__ ).'/templates/custom-sidebar-details.php'; |
|
| 56 | 56 | |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | global $wp_registered_sidebars; |
| 62 | 62 | |
| 63 | 63 | foreach ( $wp_registered_sidebars as $key => $sidebar ) { |
| 64 | - printf( '<option value="%1$s"%3$s>%2$s</option>', $key, $sidebar['name'], selected( Custom_Sidebars::get_sidebar(), $key ) ); |
|
| 64 | + printf( '<option value="%1$s"%3$s>%2$s</option>', $key, $sidebar[ 'name' ], selected( Custom_Sidebars::get_sidebar(), $key ) ); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | } |
@@ -71,14 +71,14 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function save_post( $post_id ) { |
| 73 | 73 | |
| 74 | - $sidebar_id = filter_input( INPUT_POST, 'custom-sidebar-select', FILTER_VALIDATE_INT ); |
|
| 74 | + $sidebar_id = filter_input( INPUT_POST, 'custom-sidebar-select', FILTER_VALIDATE_INT ); |
|
| 75 | 75 | $custom_sidebar = filter_input( INPUT_POST, 'custom-sidebar', FILTER_VALIDATE_BOOLEAN ); |
| 76 | 76 | |
| 77 | 77 | if ( isset( $custom_sidebar ) ) { |
| 78 | 78 | $sidebar_id = Custom_Sidebars::get_sidebar_id( $post_id ); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - update_post_meta( $post_id, '_custom_sidebar', $custom_sidebar ); |
|
| 81 | + update_post_meta( $post_id, '_custom_sidebar', $custom_sidebar ); |
|
| 82 | 82 | update_post_meta( $post_id, '_custom_sidebar_id', sanitize_text_field( $sidebar_id ) ); |
| 83 | 83 | |
| 84 | 84 | } |