-
Notifications
You must be signed in to change notification settings - Fork 11
Enable status button if current theme is not active. #132
Changes from all commits
e696e8f
80fe277
023a0a6
a372282
c71add1
58f0ce9
7a6330a
cc2f54d
26f7316
d43b570
2559457
9ca3ff2
a71adbb
eb003e3
52694b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,7 @@ public function ensure_customize_manager() { | |
* | ||
* @return bool Whether theme is active. | ||
* | ||
* @deprecated in favor of WP_Customize_Manager::is_theme_active() | ||
* @todo move to back compat? | ||
*/ | ||
public function is_theme_active() { | ||
|
@@ -225,7 +226,7 @@ public function add_snapshot_uuid_to_return_url() { | |
&& | ||
$this->current_snapshot_uuid | ||
&& | ||
$this->is_theme_active() | ||
$this->customize_manager->is_theme_active() | ||
&& | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @westonruter Not sure why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's because the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be fixed in 52694b6. |
||
false === strpos( $this->customize_manager->get_return_url(), '/wp-admin/' ) | ||
); | ||
|
@@ -263,11 +264,7 @@ static public function encode_json( $value ) { | |
* @global \WP_Customize_Manager $wp_customize | ||
*/ | ||
public function enqueue_controls_scripts() { | ||
|
||
// Prevent loading the Snapshot interface if the theme is not active. | ||
if ( ! $this->is_theme_active() ) { | ||
return; | ||
} | ||
$this->ensure_customize_manager(); | ||
|
||
wp_enqueue_style( 'customize-snapshots' ); | ||
wp_enqueue_script( 'customize-snapshots' ); | ||
|
@@ -277,6 +274,7 @@ public function enqueue_controls_scripts() { | |
if ( $this->snapshot ) { | ||
$post_id = $this->customize_manager->changeset_post_id(); | ||
$post = get_post( $post_id ); | ||
$preview_url_query_vars = $this->post_type->get_customizer_state_query_vars( $post->ID ); | ||
if ( $post instanceof \WP_Post ) { | ||
$this->override_post_date_default_data( $post ); | ||
$edit_link = $this->snapshot->get_edit_link( $post ); | ||
|
@@ -292,6 +290,7 @@ public function enqueue_controls_scripts() { | |
'currentUserCanPublish' => current_user_can( 'customize_publish' ), | ||
'initialServerDate' => current_time( 'mysql', false ), | ||
'initialServerTimestamp' => floor( microtime( true ) * 1000 ), | ||
'previewingTheme' => isset( $preview_url_query_vars['theme'] ) ? $preview_url_query_vars['theme'] : '', | ||
'i18n' => array( | ||
'saveButton' => __( 'Save', 'customize-snapshots' ), | ||
'updateButton' => __( 'Update', 'customize-snapshots' ), | ||
|
@@ -309,7 +308,11 @@ public function enqueue_controls_scripts() { | |
), | ||
) ); | ||
|
||
wp_localize_script( 'customize-snapshots', '_customizeSnapshotsSettings', $exports ); | ||
wp_scripts()->add_inline_script( | ||
'customize-snapshots', | ||
sprintf( 'var _customizeSnapshotsSettings = %s;', wp_json_encode( $exports ) ), | ||
'before' | ||
); | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad you caught this. It's something I was noticing in the case of setting validation errors, where I'd get a validation error message with a control but the Publish button would remain disabled.