Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widgets: Hide Simple Payments create and edit buttons in widgets.php #9811

20 changes: 17 additions & 3 deletions modules/widgets/simple-payments/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ class="widefat jetpack-simple-payments-widget-title"
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
value="<?php echo esc_attr( $instance['title'] ); ?>" />
</p>
<p class="jetpack-simple-payments-products-warning" <?php if ( ! empty( $product_posts ) ) { echo 'style="display:none;"'; } ?>>
<?php echo __( 'Looks like you don\'t have any products. You can create one using the Add New button below.' ) ?>
</p>
<p class="jetpack-simple-payments-products-fieldset" <?php if ( empty( $product_posts ) ) { echo 'style="display:none;"'; } ?>>
<label for="<?php echo $this->get_field_id('product_post_id'); ?>"><?php _e( 'Select a Simple Payment Button:', 'jetpack' ); ?></label>
<select
Expand All @@ -23,6 +20,10 @@ class="widefat jetpack-simple-payments-products"
<?php } ?>
</select>
</p>
<?php if ( is_customize_preview() ) { ?>
<p class="jetpack-simple-payments-products-warning" <?php if ( ! empty( $product_posts ) ) { echo 'style="display:none;"'; } ?>>
<?php echo __( 'Looks like you don\'t have any products. You can create one using the Add New button below.' ) ?>
</p>
<p>
<div class="alignleft">
<button class="button jetpack-simple-payments-edit-product"><?php esc_html_e( 'Edit Selected' ); ?></button>
Expand Down Expand Up @@ -136,3 +137,16 @@ class="field-email widefat jetpack-simple-payments-form-product-email"
</p>
<hr />
</div>
<?php } else { ?>
<p class="jetpack-simple-payments-products-warning">
<?php
echo sprintf(
wp_kses(
__( 'This widget adds a payment button of your choice to your sidebar. To create or edit the payment buttons themselves, <a href="%s">use the Customizer</a>.' ),
array( 'a' => array( 'href' => array() ) )
),
esc_url( add_query_arg( array( 'autofocus[panel]' => 'widgets' ), admin_url( 'customize.php' ) ) )
);
?>
</p>
<?php } ?>