Are you looking for a way to integrate your outer site with Worpress? Getting the theme to match your other pages is hard enough, integrating with Wordpress permalinks is a whole other battle. By default, Wordpress does not allow you to publish any php code in the custom page editor. There are a few simple ways around this. Theres the easy way, and the way that I used to think was pretty easy.
In the beginning I would actually get down and code my own pages to include the Wordpress theme tags. I would then upload the file into my main directory and manually code the link to the page into the navigation. Then I later realized that Wordpress has a feature to do this in a much simpler manner, and your new page will fit the permalinks. So lets open up our favorite text editor and get going.
Define the Template
To get things rolling, define your page as a template. To do this, use the format below using whatever template name you want
< ? php /*
Template Name: Most Popular
*/
?>
Then add the wordpress template tags to include your theme.
< ? php /*
Template Name: Most Popular
*/
?>
< ? php get_header(); ?>
<div id=”content”></div>
< ? php get_footer(); ?>
Code, code, code away
From here it is all about your creativity. You can code anything you want in here. Php and template tags are also available to you now. In the case of one of the pages I’ve made so far, I just used the template tags for the Popularity Contest plugin. You can use any code you want, this doesn’t just go for plugins. Have fun with it.
<ul><?php akpc_most_popular(); ?></ul>These tags went within the main div. Don’t forget, the main div id is usually called “Content”. Be sure to check before you publish this page.
Time to integrate
Once you’ve got your custom page coded up, its’ time to put the template to work. Save the file you’ve been coding. In my case its saved as ‘Most-Popular.php’ and upload it to the directory of your theme. www.example.com/wp-content/themes/mytheme/
Go into WP’s admin area. Create a new page. Write the post title and stop.
Now you go to the sidebar of the ‘write page’ screen and find the menu called ‘Page Template’.
Select your new template and publish the page. Now its’ time to check out your new page. It will be integrated into your navigation automatically.
There you have it. You’ve made yourself a wordpress template.
Loading...
Thanks for the clarification on this. Really needed this!
Perfect, been using wordpress for a while now and i say, this is my first time reading informations like this, thanks a lot
Pretty good article. I like it, keep it up.
I think that was a pretty good post. I couldn’t do it
. Keep up the good work.
hmmm… I like a blog post that makes me think.
I’ve been moving from blogger to WP. At first I couldn’t handle wordpress…it was just so confusing to me as a noob. But I’ve since realized the benefits of using WP and I’m starting to dig the plugins! But this code stuff, forget it. I can’t make heads or tails of this post. I just cant get that coding stuff down.