Page Links To

About

Page Links To is a plugin that allows you to make certain WordPress pages or posts link to a URI of your choosing, instead of their WordPress page or post URI. It also will redirect people who go to the old (or “normal”) URI to the new one, using a redirect style of your choosing (302 Moved Temporarily is standard, but you can enable 301 Moved Permanently redirects i f you wish.)

For instance, say you have a photo gallery installed, but can’t be bothered to integrate it into WordPress. You’ll still probably want to have a link to it from your WordPress blog. With this plugin you can create a new page called “Photos,” and give it a Custom Field links_to with the value being the URI to your photo gallery. “Photos” will show up when you use wp_list_pages();, but instead of linking to the (blank) “Photos” page, it will link you your photo gallery!

Another usage scenario is that you have content that was on a post, and want to move it to a page. You could redirect the post to the new page. And if you use a 301 redirect, search engines will eventually “find” the new location and change their links.

This plugin uses only two simple MySQL queries, no matter how many total pages or links_to enabled pages you have, so you don’t have to worry about scalability.

Usage

To redirect a page or a post, scroll down to the “Custom Fields” section on the edit screen for that entry and enter in a key of links_to with the value being the full URI you want to redirect to. If you want this to be a permanent move, you can additionally add a meta key of links_to_type with a value of “301″ (without the quotes). After saving the entry, the redirect will be active!

New in version 1.3: Now you can create a links_to_target meta key, and provide the target you would like for the link (like _new, to open the link in a new window). The target you choose will be used in wp_list_pages().

Download

Instructions

  1. Upgrade to WordPress 1.5.1.3 or higher (WordPress 2.0 required for tab highlighting feature)
  2. Upload page-links-to.php to your /wp-content/plugins/ directory
  3. Activate the “Page Links To” plugin in your WordPress administration interface
  4. Create (or edit) a page to have a title of your choosing, and a parent page of your choosing (leave the content blank)
  5. Down below, add a meta key of “links_to” (without the quotes) and give a full URI as its value

That’s it! Now, that page will link to the “links_to” URI instead of its WordPress page URI.

Possible Uses

  • Linking to an on-site non-WordPress resource (e.g. photo gallery)
  • Linking to an off-site resource (e.g. Flickr or del.icio.us page)
  • Placing a link to a 2nd, 3rd, or nth level page on the top level (i.e. you might have /archives/tags/, but want “tags” to show up on the top level)
  • Adding a link to your blog’s front page without having to modify your template and hack it in manually

Leave any bug reports or feature suggestions here in the comments.

Versions

  • 1.4 Fixes to tab highlighting
  • 1.3 You can now specify a link target via links_to_target, tab highlighting moved to WordPress 2.0 style
  • 1.2 If you link to an internal WordPress page, like a category, the menu item will get the current_item CSS class when you’re on that page
  • 1.1 Posts can have redirects, can specify redirect type (301/302), get_permalink() is filtered for posts.
  • 1.0 Initial public release.

I’ve spent a lot of time writing this code and supporting it. If you derive some benefit from this code, please consider showing your gratitute in a more tangible
way. Thanks!

I have received $0 this month for my coding efforts.

Donate with PayPalAmazon.com Wishlist


511 Responses to “Page Links To”

Comment pages: « 1 [2] 3 4 5 6 »

  1. Jonny |

    I’m having the same trouble with tab highlighting in the Blix theme. I am use the gallery2 embedded plugin and this plugin to direct to that page. I tried sending the page_id in the url, hacking the header.php, and using my site’s full url in the “links_to”, but I haven’t found a way to highlight “photos” when I am on that page. Not a big deal though, still a very useful plugin.

  2. Tom |

    Real nice plugin. Functionality like this should be added to the default WP package. Thank you for your work.

  3. wayne sutton |

    Hey thank you for this plugin….it works great for a client site i’m working on : http://lostsheepoutreachministry.org

    I’m using it with static front plugin, so the news page goes to a category page

    bless u

  4. e |

    comments #86 & #83 gave me all i needed. awesome plugin!

    thanks!

    e

  5. Pud |

    Great plugin, just what I needed to incorporate my WPG2 Gallery into wordpress.

    Thanks!
    Pud (http://www.pudweb.com)

  6. Hus |

    Is there any way of getting this to work with the Fold Page List plugin (www.webspaceworks.com/resources/cat/wp-plugins/30/) as the two together break the links_to_target functionality of the Page Links To plugin.

    Keep up the great work.

  7. Kevin Russell |

    Mark,

    Great plugin. I’m using it for my ‘Photo Gallery’ link to my on-site Gallery2 Photo Album.

    Only problem I’m having now is - I’m using another plugin ‘kgarchives’ .. which makes up an archives page (fairly common) .. but since I changed the ‘permalinks’ option to the format of ‘archives/123′ instead of the regular ‘?p=123′, I now get an error message from YOUR plugin ironically on the archives page.

    I’m no PHP expert by any means - although I’m a computer consultant with my own business .. and try to ‘tinker’ with PHP :) - I HAVE noticed that it puts the same error message for EACH archive page that is listed. For instance, with 6 archive pages listed, I get this same error message 6 times at the top of the archives page now:

    Warning: Missing argument 2 for txfx_filter_links_to_pages() in /homepages/39/d160125608/htdocs/krussell/wp-content/plugins/page-links-to.php on line 89

    Any idea what could be causing it on that line?

    I did notice that the ‘kgarchives’ uses the $post (parameter? variable?) in their plugin as well .. but not sure what to make of this.

    Thanks,

    Kevin Russell

  8. Kevin Russell |

    And ah fooey, I meant to ask you this - but notice I can’t edit the comment:

    What comment plugin are you using? I LOVE the option to have people subscribe to updates on the comments. That’s just what I’m looking for.

    Thanks - Kevin

  9. Kevin Russell |

    Okay, now really sorry for the extra comments - a little more research would have answered my question. Must be the ’subscribe to comments’ plugin you have listed under the code section. Very cool. Thanks.

  10. rebecca |

    Excellent plugin! Was able to link a gallery using a 3k2 template. Thanks.

  11. LTR |

    I was looking around for something like this, thinking “I bet nobody’s even done a plugin for this,” and I found it. Not only that, but it’s very professionally done. Thanks!

  12. Felipe |

    Awesome plugin, works great ;)
    it’s exactly what i was looking for.
    You can see it working at http://www.bloog.cl

  13. Tessa |

    Very nice plugin. Would be nice to turn off test output with an argument or have this removed in the next version.

    These lines in particular:

    echo “”;

  14. maira |

    Great plugin, works perfectly for my site “fotos” page. Would it be possible to add children pages to the WordPress page?

  15. Sora |

    Awesome.. just what i was looking for ;-) .. keep up the good work

  16. Jonathan |

    I’m having a small issue with the plugin - actually, it’s probably more of a style issue, but I thought it would be appropriate to ask here. When I create a new page, it’s displayed with an underline. Is there a way to remove it?

  17. Jonathan |

    Ah, you can strike my previous post. I managed to fix it. It was a stylesheet error.

    This plugin is wonderful!

  18. Nyssa |

    Excellent plug-in. It’s just what I was looking for. Works like a charm, too. :)

Comment pages: « 1 [2] 3 4 5 6 »

Leave a Reply