WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Page template to link to other pages

[Resolved] Page template to link to other pages

  • davestewart
    Member

    @davestewart

    I’ve seen the topic of linking to “static” pages come up a few times, but this is slightly different.

    My WP enabled site is here: http://www.keyframesandcode.com

    On the top right, I have 3 links, and the bottom one “Latest developments…” links to the archive of “Development”.

    Basically, it’s a standard page template, and the content is just a javascript that changes the browser’s location.href to the permalink of my “Development” category.

    http://www.keyframesandcode.com/code/category/development/

    To me, this screams “HHAAACCCKKKKKK!!!!!!”, and I feel dirty. Plus, there’s an annoying pause as it loads the first, then the second page.

    Is there a better way to do this?

    I have one idea:

    1. I enter the url I want to redirect to as the page content, in this case ‘http://www.keyframesandcode.com/code/category/development/’.
    2. Then in the page template, I just grab that value and then output it as part of a PHP location header:
      <?php
      $link = the_content();
      if($link){
      	header("Location: $link");
      }
      ?>

    I think it all sounds very logical, but am I doing my usual thing and over-engineering here because I don’t know wordpress well-enough?

    Cheers,
    Dave

Viewing 1 replies (of 1 total)
  • davestewart
    Member

    @davestewart

    Well I just went ahead and did it, and it couldn’t be easier.

    • I just stick a URL in the Page Content area
    • Set the template as Page Redirect
    • Publish

    Niiiiiiiiiiiiiiiiice.

    More info and download is here.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Page template to link to other pages’ is closed to new replies.