How can we help?

If you are looking for support for our PokaTheme, this is the place!

Home Forums PokaTheme support How to prevent the Play Now button to do any redirection?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #17522

    Hi there,

    In have an Affiliate Review that is assigned to an Affiliate Link:
    Affiliate key: 888_casino
    Affiliate link: (empty)
    Affiliate onclick event: (empty)

    What happens is
    – when I mouse hover the button, I still see the link “…/go/888_casino”
    – when I click on it, I’m still redirected. I would like not to be redirected as long has the affiliate link is empty.

    Note: impossible to not assign an Affiliate Link to an Affiliate Review. Once it is assigned in the DropDown, there is no option to remove the Affiliate Link from the assignation.

    Also, whatever I put in the field Affiliate onclick event (for example: console(‘hello’); ), nothing shows up in the console.
    As if none of the changes do anything.

    Before you ask 🙂 After each change I clear the cache, I save the permalinks again, nothing seems to take this into account.

    I have these problems on several sites.
    On other site, the Play Button redirect to the review page.

    Anything I’m doing wrong here?

    Thanks!

    #17527
    admin
    Keymaster

    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 1 year, 2 months ago by admin.
    #17538

    Hi,

    thank you for the piece of code, really appreciate it, I will insert it and test.

    To answer your question, there are situations where you don’t necessarily want to send traffic to the merchant right now, but still want to publish a review for SEO purpose.
    So, in such case, you would like to deactivate the Play Now button. Which I couldn’t find a way to prevent from.

    Consequently, I would like to unset the Affiliate Link from the Affiliate (Review), but how? In the Affiliate (Review) edit page, in the Affiliate Fields block, the Affiliate Link dropdrown list list all existing Affiliate Link but there is no option to unset once it’s been attached.
    How can I unset the relation?

    thanks!

    #17539

    Should I maybe open a new ticket for that question? (how to completely unset a relation Affiliate – Affiliate Link?)

    #17545
    admin
    Keymaster

    Hi Jean-Sebastien,

    Do you want to completely remove (hide) the “Play Now” button in the front-end?

    If this is the case, do you want to do this for ALL reviews, or for specific reviews?

    #17548

    Hi 🙂

    Only for specific reviews, those where there is no (not yet) redirection URL.

    I have modified your code above so that it doesn’t display the “Play Now” button when the Affiliate Link URL field is empty.

    #17553
    admin
    Keymaster

    Hi Jean-Sebastien,

    So I understand that problem solved, right? 🙂

    #17554

    Yes right,

    thanks!

    #17957
    admin
    Keymaster

    This is just an update that we have released a new PokaTheme version and we have included a fix for this issue, too. Feel free to check your account downloads and get the latest version!

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.