I use a plugin that among other stuff generates an icon on the product page. Once a user clicks on the icon, it resets all layers of an image on the screen to a default state. I would like to write a snippet PHP code that will mimic that same function, but to have it executed every time the page finishes loading.
from what i’ve found in the src files, this option is divided between 2 files, a .js and a .php as followed:
.js file
$('.js-wpc-reset-config').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
var $self = $(this),
configID = $self.data('id');
wpc.applyComponent(configID, wpc_reset_keys[configID], 'reset');
});
.php file
<ul class="wpc-floating-icons">
<?php
if ( WPC_Utils::str_to_bool( $inspiration ) ) {
?>
<li data-text="<?php esc_attr_e( 'Inspiration', 'wp-configurator-pro' ); ?>">
<a href="#" data-id="<?php echo esc_attr( $this->id ); ?>" class="js-wpc-open-inspiration-popup-trigger"><span class="wpc-inspiration"></span></a>
</li>
<?php
}
if ( WPC_Utils::str_to_bool( $take_photo ) ) {
?>
<li data-text="<?php esc_attr_e( 'Take Photo', 'wp-configurator-pro' ); ?>">
<a href="#" data-id="<?php echo esc_attr( $this->id ); ?>" class="js-wpc-take-photo"><span class="wpc-camera"></span></a>
</li>
<?php
}
if ( WPC_Utils::str_to_bool( $reset ) ) {
?>
<li data-text="<?php esc_attr_e( 'Reload', 'wp-configurator-pro' ); ?>">
<a href="#" data-id="<?php echo esc_attr( $this->id ); ?>" class="js-wpc-reset-config"><span class="wpc-reset"></span></a>
</li>
<?php
}
Any ideas how it can be done?