Support » Fixing WordPress » Need Help getting links to open in new tab

  • lgehrig4

    (@lgehrig4)


    I’m helping a non-profit with their WordPress site. They asked me to enter some portfolios and I notices that the ‘URL for Launch Button’ links take you away from the site. I would like to have these open in a new tab.

    I’ve created a few WordPress sites so I’m pretty familiar with the process, but I’ve never worked with portfolios. I’m not sure where the template is for this page. I tried editing via Block Editor, Classic and Elementor and none have the option to make changes to this button. I checked the saved templates and none of them seem to be related to this page.

    I have admin access so it shouldn’t be my permissions. I attached a link to one of the pages I’m referring to.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    What plugin are you using to build the portfolio?

    lgehrig4

    (@lgehrig4)

    The site has been around for a while and I’ve only currently been making updates. The theme is Phlox Child if that matters. I’m not building the portfolio, just added additional items.

    For this I go to portfolio > new and then add the information. For URL in question I just enter it into a field called ‘URL for Launch Button’ but there are no other options for this field. I don’t know where the HTML or CSS for this page is coming from.

    For the other stuff I’m doing I use Elementor Pro, but when adding these portfolios I use the block editor. I have the option to edit the portfolio with Elementor, but when I try I can only touch the header and footer.

    There are quite a few of these portfolios and I would love to make a global change to make these urls open in a new tab.

    edit: I justs checked the Phlox docs and this is a Phlox porfolio. Can’t find what I’m looking for though

    • This reply was modified 3 months ago by lgehrig4.
    lgehrig4

    (@lgehrig4)

    Was hoping I could find a built in way but I ended up using JS

    window.onload = function(){
      let anchors = document.getElementsByClassName('aux-button');
      for (let i=0; i<anchors.length; i++){
        anchors[i].setAttribute('target', '_blank');
      }
    }

    oh nevermind… I wrote out a long answer but if what you did above works then do that. Although I’d recommend not adding custom code like that unless you really have to because you dont know if a later version of the theme will work with that or not.. the safest bet for you is to ask the theme developer if you can set the links to open in a new window via settings or something.

    lgehrig4

    (@lgehrig4)

    Thanks @brothman01. I actually worked it out with javascript (see post above yours), but I did try your option 1 and it did not work

    @lgehrig4 yeah I changed that answer so it says something else now.. try that.

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