• Resolved ~MR

    (@mediblereview)


    Hello,

    When using the widget, both the “Buy Now” and the “Read Review” buttons open in a new window. I am trying to make the “Read Review” buttons to open in the same window, the “Buy Now” button is fine.

    I saw in the help docs section something about adding the following javascript to the pages:

    var abtns = document.querySelectorAll( '.affiliate-button a' );
    abtns.forEach( function( btn ) {
    	btn.removeAttribute( 'target' );
    });

    I tried this, but nothing changed. Can someone point me in the right direction?

    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor contactashish13

    (@rozroz)

    @mediblereview can you please share the URL of this page where you are trying to do this?

    Thread Starter ~MR

    (@mediblereview)

    Plugin Contributor contactashish13

    (@rozroz)

    @mediblereview that page is not accessible.

    Thread Starter ~MR

    (@mediblereview)

    Oops, sorry I made a typo: https://www.mediblereview.com

    Just a heads up, to rule out any other plugin or theme issue I performed the following:

    – cloned the site
    – installed default WordPress 2020 theme
    – activated only the Review plugin and a plugin called “scripts n styles” for placing the javascript on the pages.

    All buttons open in a new window. You can see the clone site by replacing the www with qt

    Thanks again

    Plugin Contributor contactashish13

    (@rozroz)

    @mediblereview this is a simple javascript snippet that we do not usually help our users with.

    Please use the below snippet or a variation of it. We have tried it on the console of your clone site and it works perfectly. If it does not work for you, I would suggest contacting a JS developer.

    
    jQuery('.wppr-style1-buttons a').each(function(i, element){jQuery(element).removeAttr('target');});
    

    If you are satisfied with our product, kindly spare a moment to leave us a review. It would really help us spread the word!

    Thread Starter ~MR

    (@mediblereview)

    Unfortunately that did not work either, all buttons still open in a new window.

    Pasting into the console works, but when I add the code to the site using the Custom CSS and JavaScript plugin as per your tutorial, it doesn’t seem to be running. -> qt.mediblereview.com

    I followed your guide here: https://docs.themeisle.com/article/822-how-to-open-buttons-in-same-tab-in-wp-product-review

    • This reply was modified 4 years, 9 months ago by ~MR.
    Thread Starter ~MR

    (@mediblereview)

    Clicking the thumbnail opens in the same window, clicking the button opens in a new window.

    Perhaps someone could just enlighten me as to where the offending “target=_blank” attribute is hiding? I am more than willing to edit the code…

    Plugin Contributor contactashish13

    (@rozroz)

    @mediblereview unfortunately, we cannot help you beyond this. You may want to check with the creators of that plugin why it does not run.

    Thread Starter ~MR

    (@mediblereview)

    Ok, I assumed that the plugin you said to use in your own documentation would work….my mistake for following your instructions I guess.

    So do you know which plugin to add the code actually works? I have tried 4 different plugins, and it does not work in any of those.

    Plugin Contributor contactashish13

    (@rozroz)

    @mediblereview we expect our users to do their own due diligence as well, especially when the matter concerns a third-party plugin that is not under our control or supervision.

    Unfortunately, we cannot help you beyond providing the snippet. You can add it using a plugin that works or in the theme’s functions.php.

    Plugin Contributor contactashish13

    (@rozroz)

    Marking this as resolved.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Forcing widget button links to open in same window’ is closed to new replies.