Support » Plugin: Page Links To » [Plugin: Page Links To] Link STILL doesn't open in new window

  • I know this has been mentioned a number of times, but I’ll bring it up again since those posts are closed to further discussion.

    Even though the “open in new window” box is checked, it’s not doing so.

    If there is no support for this plugin anymore, and no fix for this problem, can anyone recommend a different plugin that does basically the same thing as this one is supposed to do? I have a few WP sites that need external link menu items (which open in a new window), and I haven’t been able to track down anything else.

    http://wordpress.org/extend/plugins/page-links-to/

Viewing 15 replies - 1 through 15 (of 23 total)
  • I am having the same issue. “Open in new window” is checked, but the correct link opens in the same window. I can not make heads or tails of the javascript… Help?

    I should have added that I just did the most recent WordPress update on a fresh install, using a copy of the twenty-eleven theme.

    When I look at the plugin php file, the last section seems to be telling it to add a javascript to the html head within an if-else statement about targets. However the javascript is not there when I look at the page source.

    If I remove the if-else part of the statement so that it just adds no matter what, it shows up, but the external links still open in the same window and not a “_blank” target.

    This seems to have broken after the new WordPress release was installed earlier this week. I checked another thread in this forum and the “extra space” solution did not work (the newest version of the plugin does not have an extra space).

    No help?

    I think I found part of the issue – the string replace for ‘<a href=”‘ can not replace because the actual string begins with ‘<a title=”(title’ before the href is defined. So the string to replace does not exist.

    However, modifying the string replace script to just replace from href did not solve the issue.

    Ok, for me the issue is that there is a conflict with the plugin I am using to display the posts. I could not test the posts without the plugin because without the plugin it was hard to display the correct posts on the page.

    The plugin is “List category posts”. This plugin writes the page-links-to url correctly, but does not take target into account.

    I’m experimenting with modifications to list-category-posts.

    Ok, for users who also have list-category-posts plugin and are seeing page-links-to opening in the same window, here’s a brief summary of the cause and specific details on how to get things working so that the new window opens.

    Cause: Page-Links-To sets the post url in the database, but uses a script to re-write the link tag if the “open in a new window” feature is checked for the post. List-Category-Posts gets the url from the database, but uses its OWN script to write the link tag – it never sees and can not implement the Page-Links-To script, which contains the “new window if box is checked” logic.

    This means that in order to get List-Category-Posts to open posts in a new window, you have to create new functions that write the link tag with “target=’_blank'” in it, create a List-Category-Posts template for it that calls those functions, and use that template when you want a new window. This method will work for a list of links that must open in a new window and for a list that does not, but you will not be able to have a mixed list (unless, that is, you create a brilliant solution on your own). I hope also that experienced php coders will forgive anything I am recommending here that may be redundant.

    To get List-Category-Posts to make a list of links that open in a new window:

    In CatList.php:

    • Find the function “get_category_link”
    • Copy and paste this function below the original
    • Re-name it to “get_category_link_new_win”
    • Change the line return '<a href="' . $cat_link . '" title="' . $cat_title . '">' . to return '<a href="' . $cat_link . '" title="' . $cat_title . '" target="_blank">' .
    • Find the function “get_the_post_thumbnail”
    • Copy and paste this function below the original
    • Re-name it to “get_the_post_thumbnail_new_win”
    • Change the line $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">'; to $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'" target="_blank">';

    In CatListDisplayer.php:

    • find the function “get_thumbnail”
    • Copy and paste it below itself
    • Re-name it to “get_thumbnail_new_win”
    • Change the line $info = $this->catlist->get_thumbnail($single, $lcp_thumb_class); to $info = $this->catlist->get_thumbnail_new_win($single, $lcp_thumb_class);
    • find the function “get_post_title”
    • Copy and paste it below itself
    • Change the line $info = '<a href="' . get_permalink($single->ID) . '">' . to $info = '<a href="' . get_permalink($single->ID) . '" target="_blank">' .

    Open list-category-posts/templates/default.php and save it to (your template folder)/list-category-posts/new-window.php

    • Please note the new file must be in a NEW list-category-posts folder in YOUR template folder, not the plugin folder!
    • Change $lcp_display_output .= $this->get_thumbnail_mm($single); to $lcp_display_output .= $this->get_thumbnail_new_win($single);
    • Change $lcp_display_output .= $this->get_post_title_mm($single); to $lcp_display_output .= $this->get_post_title_mm($single);
    • Save that sucker.

    Now in WordPress, in your shortcode to create a list that uses the new-window template, put template=new-window before the ending bracket.

    Behold! If I have made no critical typos and you have copied and pasted with diligent accuracy, you should now have a list of posts that open in a new window.

    Good luck! 🙂

    I wish I had the experience to follow this last post, but I don’t and like missdeja said, the open in new window box is checked but it’s not working and I’m using 3.4.1

    I’m confused

    Dale, I also, unfortunately, don’t have the expertise to follow deborah64554, but I did find a solution.

    The plugin, “Open External Links in a New Window” (http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/), overrides the problem. Don’t disable “Link Opens To”, but use them simultaneously!

    Plugin Author Mark Jaquith

    (@markjaquith)

    WordPress Lead Dev

    The plugin only modifies links that appear (a) In a WordPress nav menu (b) in an oldschool wp_list_pages() output, or (c) is a post in the main “loop” query.

    If you’re using custom functions to output the links some other way, it won’t work.

    I’m considering ways to lift these restrictions, without introducing a lot of overhead.

    I’m having the same problem. Even though the “open in new window” box is checked, it’s not doing so.

    Does anyone have solution to this?

    @deborah64554 – Do you have a general solution for those who are not also using the List-Category-Posts plugin? Yours appears to be the only potential solution I have found, its clearly a problem for anyone thats using the plugin in general

    Same issue here. Up-to-date plugin/WP install. Is there a fix or work-around?

    What MissDeja said above works great!!! Not sure why or how (ha,ha,ha!!) but it works!!!

    I added the “Open External Links in a New Window” plugin and am still having problems.

    My site is http://www.pwdoherty.com

    I am clicking from the slider menu to my expernal page http://www.phonatomy.com.

    A new browser window opens with phonatomy.com but the original browser window – also redirects to phonatomy.com.

    What am I doing wrong? A bit of a novice here….

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘[Plugin: Page Links To] Link STILL doesn't open in new window’ is closed to new replies.