Need to add target=_blank to External Links Permanently

Home Forums Cera – Intranet & Community Theme Unsupported Plugins Need to add target=_blank to External Links Permanently

This topic contains 4 replies, has 2 voices, and was last updated by  Manathan 1 month, 2 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26351

    Varun
    Participant
    • 1 Posts
    @varunmahajan

    Hi, I’m trying to add target=_blank and rel=nofollow to external links permanently excluding my subdomains.

    I’ve external links posted in content and quiz answers on course pages and am using focus mode.

    I tried using the plugin Wp External Links but it doesn’t work. Next, I tried using the below script, and it still doesn’t work. How can I solve this, please?

    
    $(document).ready(function() {
    
       $("a[href^=http]").each(function(){
    
          // NEW - excluded domains list
          var excludes = [
             'excludeddomain1.com',
             'excludeddomain2.com',
             'excluded.subdomain.com'
          ];
          for(i=0; i<excludes.length; i++) {
             if(this.href.indexOf(excludes[i]) != -1) {
                return true; // continue each() with next link
             }
          }
    
          if(this.href.indexOf(location.hostname) == -1) {
    
               // attach a do-nothing event handler to ensure we can 'trigger' a click on this link
               $(this).click(function() { return true; }); 
    
               $(this).attr({
                   target: "_blank",
                   title: "Opens in a new window"
               });
    
               $(this).click(); // trigger it
          }
       })
    });
    
    #26401

    Manathan
    Keymaster
    • 1450 Posts
    @themodactyl
    Themosaurus Support

    Hi @varunmahajan,

    Thanks for buying our theme. We hope it will meet all your expectations! 🙂

    We’ve received your request and we’ll get you an answer shortly.

    We really thank you for your patience!

    In the meantime, feel free to check out our documentation resources for more help:

    FAQ & Support Documentation

    Kind regards,

    #26475

    Manathan
    Keymaster
    • 1450 Posts
    @themodactyl
    Themosaurus Support

    Hi @varunmahajan,

    Thank you for your patience. 🙂

    This is standard behavior with WordPress, I’m afraid.

    As this is not breaking the website, changing this is considered customization work. Unfortunately, this is a service that we do not provide.

    We only share snippet only to solve issues with our theme. Any further request for CSS snippets will have to be part of a defect that needs to be fixed urgently. No snippets will be shared otherwise.

    If you want to go further with the customization of your website, we advise that you hire a freelancer to do it for you.

    If you’re on a tight budget, we recommend you to require the services from Envato Studio freelancers (https://studio.envato.com/explore/websites-programming). This web platform gives you access to developers who have already experience with theme customizations, and for very competitive prices.

    Thank you for your understanding.

    #26482

    Varun
    Participant
    • 1 Posts
    @varunmahajan

    Hi Manathan,

    I understand the standard WordPress behaviour which anyone can generally change with plugins. I’m trying to do the same. But its’s the LearnDash plugin which is not letting me run jQuery or other Javascript codes in the Focus mode. Then it has to be rectified from the LearnDash side.

    Kindly do the needful.

    #26532

    Manathan
    Keymaster
    • 1450 Posts
    @themodactyl
    Themosaurus Support

    Hi @varunmahajan,

    Unfortunately, we have no clue. 🤷‍♂️

    As this issue is related with LearnDash, it’s best if you try to reach the plugin authors. They will be more informed and better suited to help you.

    To go further, we invite you to post your request on their support forums:

    Knowledge Base

    We remain available for all support requests related with the use of your theme.

    Best,

Hi there,

This topic has been inactive for a while now so we will be closing it to keep the forum tidy. Don't hesitate to create a new topic if you still need help and we'll be glad to help you!

Best regards,
The Themosaurus team.

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Need to add target=_blank to External Links Permanently’ is closed to new replies.