Support » Fixing WordPress » target="_blank" for a page on menu?

  • 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 - 16 through 30 (of 55 total)
  • Bhavadasa

    (@bhavadasa)

    Thanks for your patients!

    Ok, I inserted the code. However, it seems to have canceled out the “Piecemaker Slider”, and the menu disappeared.

    http://www.SaranagatiVillage.com

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    Instead try
    $('li.page_item page-item-136 a').attr('target','_blank')

    Bhavadasa

    (@bhavadasa)

    I replaced it. However, the page remained as I described it above. So, I uploaded a fresh copy of footer.php–still no change. Then I cleared the cache. Again, no change.

    It’s a new site under construction, so no problem. Is it something I have done?

    Here’s how I put it (did the space cause the problem?):

    <?php wp_footer(); ?>
    
    $('li.page_item page-item-136 a').attr('target','_blank')
    
    </body>
    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    Sorry, you need this

    <?php wp_footer(); ?>
    
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript">
    $('li.page_item page-item-136 a').attr('target','_blank')
    </script>
    
    </body>
    Bhavadasa

    (@bhavadasa)

    Nope. That didn’t do it either. Sorry to be a pain.

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    yes sorry I’ve just edited that post
    to this

    <?php wp_footer(); ?>
    
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript">
    $('li.page_item page-item-136 a').attr('target','_blank')
    </script>
    
    </body>

    Bhavadasa

    (@bhavadasa)

    You’re probably wishing about now, that you never responded to my post, eh?

    Unfortunately, that didn’t do it either. However, I did notice behind the images that something seemed to happen.

    I can reinstall the theme–no problem. I don’t want to waste your time on
    this issue (the slider).

    I don’t want you to get burnt out!

    I still need the _blank to work.

    What do you think?

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    Try

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

    Bhavadasa

    (@bhavadasa)

    Nope.

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    Oh dear I’ve failed miserably,
    try this,

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

    (@bhavadasa)

    Well! The slider still isn’t working…..

    But… _blank WORKS!!! Fantastic!

    So what do you think I should do about the slider? Reinstall the theme, wp, or… and then come back to the footer.php, and reinsert the correct code above?

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    No need to reinstall,

    This code in the footer.php file
    <script type="text/javascript" src="/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=3.2.1"></script>

    Needs to be above this code
    <script type="text/javascript" src="/wp-content/themes/framerate/framerate/js/coin-slider.min.js"></script>
    in the header.php file

    Bhavadasa

    (@bhavadasa)

    Hmmmm…

    <script type=”text/javascript” src=”/wp-content/themes/framerate/framerate/js/coin-slider.min.js”></script>

    isn’t in the header.php file.

    Moderator Andrew Nevins

    (@anevins)

    Forum moderator

    could you post me your header.php file and I’ll point you in the direction where you need to place it.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    Stepping waaaaay back on this… Are you using WordPress’ menu system (Under Apperance -> Menu)?

    Because you can do that fairly easily by clicking on ‘Screen Options’ (upper right hand corner) and checking the box for ‘Link Target’

    Then when you edit your menu items, it’ll show a checkbox for “Open link in a new window/tab”

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