Hi Jean Sebastien,
You should always set an Affiliate Link if you want the affiliate button to redirect to somewhere. Otherwise, what do you want it to do when you click it?
For the onclick event, indeed there is a bug on our end which will be fixed on the next version release. For now you could fix it by adding the following code to your child theme functions.php
add_filter( 'wp_kses_allowed_html', 'return_allowed_a_tags', 10, 2 );
function return_allowed_a_tags( $allowed_tags, $context ) {
if ( 'post' !== $context ) {
return;
}
$allowed_tags['a']['onclick'] = true;
return $allowed_tags;
}
/**
* Return affiliate button
*/
if ( ! function_exists( 'poka_affiliate_button' ) ) {
function poka_affiliate_button( $review_id, $classes = '' ) {
$allowed_html = wp_kses_allowed_html( 'post' );
$classes = apply_filters( 'poka_affiliate_button_classes', 'btn btn-primary ' . $classes );
$affiliate_link = poka_get_field( 'affiliate_link', $review_id );
$onclick_event = poka_get_field( 'affiliate_onclick_event', $affiliate_link );
$btn = '<a href="' . poka_affiliate_link( $review_id ) . '" ' . poka_affiliate_link_atts( $review_id ) . ' class="' . $classes . '" onclick="' . $onclick_event . '">' . poka_get_translation( 'Play Now' ) . '</a>';
return apply_filters( 'poka_affiliate_button', $btn );
}
}
-
This reply was modified 2 years, 2 months ago by
admin.