ss_blog_claim=60679a3cd67cf5e494605bdbb2b9666e Use custom templates to integrate Wordpress | Needless Productions
« Living up to my promises Liquified the layout »

Use custom templates to integrate Wordpress

October 22, 2007 |

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’.

custom 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.


Related Posts

  • None Found

If you thought this post was tasty you'll love what we cook up next!
Subscribe by RSS to be updated instantly.


Tagged : Wordpress, design, blogging