• 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 10 replies - 46 through 55 (of 55 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I still see this

    <script type="text/javascript">
    $('li.page_item page-item-136 a').attr('target','_blank')
    </script>

    Are you sure you removed it?

    Thread Starter Bhavadasa

    (@bhavadasa)

    Sorry, I misunderstood that. I should change
    <li> to <p>?

    Thread Starter Bhavadasa

    (@bhavadasa)

    I think I’m taking too much of your time! I’ll just have to live with it on another part of the page. I have other questions to ask, and don’t want to fry you out.

    Thanks for sticking in there with me!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It’s alright, I’m asking you to remove this code

    <script type="text/javascript">
    $('li.page_item page-item-136 a').attr('target','_blank')
    </script>

    (but keep the code with the dot)

    I was talking about the <p> hypothetically.

    Thread Starter Bhavadasa

    (@bhavadasa)

    Well, I did do that, but the source and the target pages both load as discussions.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I suspect this is still due to both jQuery codes in the page:

    You don’t want this (below)

    <script type="text/javascript">
    $('li.page_item page-item-136 a').attr('target','_blank')
    </script>

    You want this (below)

    <script type="text/javascript">
    $('li.page_item.page-item-136 a').attr('target','_blank')
    </script>

    Thread Starter Bhavadasa

    (@bhavadasa)

    You were right. There was another one…way up at the top. I’ve removed it.

    I did notice this right before this script:

    <?php wp_footer(); ?>

    I don’t know enough about script. Is this supposed to be closed at the end? </> or something?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    The last thing I’ll recommend is changing

    <script type="text/javascript">
    $('li.page_item.page-item-136 a').attr('target','_blank')
    </script>

    to

    <script type="text/javascript">
    $('li.page-item-136 a').attr('target','_blank')
    </script>

    Thread Starter Bhavadasa

    (@bhavadasa)

    Well, I must have done something, somewhere I shouldn’t have.

    Anyway, I tried that with the same result. I would have liked that link on the menu, but I’ll just have to find somewhere else for it.

    I really appreciate your time and patients! First class!!!

    Thank you very much!

    Yikes! 9 hours!

    Or you can install WP links the external link handler automatically parses target_blank on all external links.

    https://www.ads-software.com/extend/plugins/wp-links/

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