Page template to link to other pages
-
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: https://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.
https://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:
- I enter the url I want to redirect to as the page content, in this case ‘https://www.keyframesandcode.com/code/category/development/’.
- 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
- The topic ‘Page template to link to other pages’ is closed to new replies.