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?
Tagged: Affiliate link
- This topic has 8 replies, 2 voices, and was last updated 1 year, 3 months ago by admin.
-
AuthorPosts
-
January 20, 2023 at 5:52 pm #17522Jean-Sebastien GerardParticipant
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!
- This topic was modified 1 year, 8 months ago by Jean-Sebastien Gerard. Reason: typo
- This topic was modified 1 year, 8 months ago by Jean-Sebastien Gerard. Reason: typo
January 23, 2023 at 11:19 am #17527adminKeymasterHi 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, 8 months ago by admin.
January 23, 2023 at 6:14 pm #17538Jean-Sebastien GerardParticipantHi,
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!
January 23, 2023 at 7:35 pm #17539Jean-Sebastien GerardParticipantShould I maybe open a new ticket for that question? (how to completely unset a relation Affiliate – Affiliate Link?)
January 24, 2023 at 11:57 am #17545adminKeymasterHi 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?
January 24, 2023 at 4:17 pm #17548Jean-Sebastien GerardParticipantHi 🙂
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.
January 25, 2023 at 10:47 am #17553adminKeymasterHi Jean-Sebastien,
So I understand that problem solved, right? 🙂
January 25, 2023 at 4:12 pm #17554Jean-Sebastien GerardParticipantYes right,
thanks!
June 14, 2023 at 4:49 pm #17957adminKeymasterThis 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!
-
AuthorPosts
- You must be logged in to reply to this topic.