WC_Admin_Addons::output_button
Outputs a button.
Method of the class: WC_Admin_Addons{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_Admin_Addons::output_button( $url, $text, $style, $plugin );
- $url(string) (required)
- Destination URL.
- $text(string) (required)
- Button label text.
- $style(string) (required)
- Button style class.
- $plugin(string)
- The plugin the button is promoting.
Default:''
WC_Admin_Addons::output_button() WC Admin Addons::output button code WC 10.6.2
<?php
public static function output_button( $url, $text, $style, $plugin = '' ) {
$style = __( 'Free', 'woocommerce' ) === $text ? 'addons-button-outline-purple' : $style;
$style = is_plugin_active( $plugin ) ? 'addons-button-installed' : $style;
$text = is_plugin_active( $plugin ) ? __( 'Installed', 'woocommerce' ) : $text;
$url = self::add_in_app_purchase_url_params( $url );
?>
<a
class="addons-button <?php echo esc_attr( $style ); ?>"
href="<?php echo esc_url( $url ); ?>">
<?php echo esc_html( $text ); ?>
</a>
<?php
}