• Resolved Bhavadasa

    (@bhavadasa)


    I’ve created a discussions board, and a page on the menu with the same address. It works well. However, rather than loading in a new tab (keeping the webpage open), it loads in the same tab.

    Is there a php, or somewhere I can add target=”_blank” to the address?

    Thanks!

Viewing 15 replies - 1 through 15 (of 55 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Ooops misread, I’ll post something more sensible

    Thread Starter Bhavadasa

    (@bhavadasa)

    Yikes. Lost me. Can you give me a little direction?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    There should be a section either within the PHP that’s constructing the hyperlink, which you can add target="_blank" to the link.

    Do you know which file holds this?

    Thread Starter Bhavadasa

    (@bhavadasa)

    No, that’s part of my problem. I’ve scanned a number of php files, but can’t find that (discussions) address anywhere.

    Years ago, I had a website that I was able to find the menu with “Home” in it. Then next to it (for another page) I simply added the url with target=”_blank” — and it worked. But, I’m not having such luck now.

    Thread Starter Bhavadasa

    (@bhavadasa)

    On “View Page Source” I find the below code . (it appears differently when posted here). But where do I find it, to edit?

    <body>
    <div id=”page2″>
    <div id=”header”>
    <div class=”logo_resize”>
    <div class=”logo”>
    <h1>
    Saranagati Village Inc.
    </h1>
    <small class=”slogan”>
    The Official Website of the Board of Directors for SVHI </small></div>
    <!– /logo–>
    <div class=”topnav”>
    <ul class=”menusm”>
    <li class=”page_item page-item-27 current_page_item”>Home
    <li class=”page_item page-item-32″>Blog
    <li class=”page_item page-item-136″>Discussions
    <li class=”page_item page-item-126″>Membership
    <li class=”page_item page-item-40″>Contact

    </div>
    <!–/topnav –>
    </div>

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Okay, in that code (above),
    could you repost it in the code tags (otherwise the hyperlink wont show up properly, as you can see there’s no <a> tags).

    Then could you say which hyperlink you want to have a target blank?

    Thread Starter Bhavadasa

    (@bhavadasa)

    This system isn’t allowing the coding to post as it appears in “view page source”. I’ll try the hyperlink….

    It’s line #136:> Discussions:

    Thread Starter Bhavadasa

    (@bhavadasa)

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Are you using the

    code

    button (just above this text box when replying) to wrap your code?

    Thread Starter Bhavadasa

    (@bhavadasa)

    This is the “index” page, right? Where do I find it as it appears “view page source”? I’ve looked in the “index.php, but no sign of it. Hmmm…

    Thread Starter Bhavadasa

    (@bhavadasa)

    Using the code button? No.

    Thread Starter Bhavadasa

    (@bhavadasa)

    Sorry about that!

    <body>
    <div id="page2">
    <div id="header">
      <div class="logo_resize">
        <div class="logo">
          <h1><a href="https://www.saranagativillage.com" title="Saranagati Village Inc. - The Official Website of the Board of Directors for SVHI">
            Saranagati Village Inc.        </a></h1>
          <small class="slogan">
          The Official Website of the Board of Directors for SVHI      </small></div>
        <!-- /logo-->
        <div class="topnav">
          <ul class="menusm">
            <li class="page_item page-item-27 current_page_item"><a href="https://www.saranagativillage.com/">Home</a>
    <li class="page_item page-item-32"><a href="https://www.saranagativillage.com/blog/">Blog</a>
    <li class="page_item page-item-136"><a href="https://www.saranagativillage.com/discussions/">Discussions</a>
    <li class="page_item page-item-126"><a href="https://www.saranagativillage.com/membership/">Membership</a>
    <li class="page_item page-item-40"><a href="https://www.saranagativillage.com/contact/">Contact</a>
    
        </div>
        <!--/topnav -->
      </div>
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Instead of fishing through the page for it, you could use jQuery to add the target of blank to your menu item.

    You said you want it for Discussions?
    Assuming the Discussions link will start with https://

    $('.topnav a[href^="https://"]').attr('target','_blank');

    Thread Starter Bhavadasa

    (@bhavadasa)

    Ok. Sorry, this is a little bit above me…

    I don’t know how to use jQuery
    Where would I find that specific code?
    I assume that I would insert the address after “https://. Correct?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    In the admin panel,
    Go to
    – Appearance
    – Editor

    on the right hand side, look at Templates section
    – find footer.php
    – click on footer

    – paste this above </body>

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript">
    $('.topnav a[href^="https://"]').attr('target','_blank');
    </script>

    ——

    I assume that I would insert the address after “https://. Correct?

    Correct but only in the navigation menu. Are there some links (that start with http) you don’t want to add target of blank?

Viewing 15 replies - 1 through 15 (of 55 total)
  • The topic ‘target="_blank" for a page on menu?’ is closed to new replies.