How can we help?

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

Home Forums PokaTheme support Affiliate links rel tags

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14460

    Hello, im trying to add rel=”sponsored” tags to affiliate links, can you tell me how to do it ?

    #14466
    admin
    Keymaster

    Hi!

    You can add this attribute with the snippet below:
    (Add it to functions.php in your child theme)

        function poka_link_onclick( $linkID , $link_type = 'desktop' ) {
    
            $output = apply_filters('poka_add_attr_aff_link', "");
            if( get_field('affiliate_onclick_mobile',$linkID) && $link_type === 'mobile' ) {
                $output .= "onclick='".get_field("affiliate_onclick_mobile",$linkID)."'";
            }
            else if( get_field('affiliate_onclick',$linkID) ) {
                $output .= "onclick='".get_field("affiliate_onclick",$linkID)."'";
            }
    
            $output .= ' rel=”sponsored”';
    
            return $output;
        }
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.