Jump to content


[Wordpress] wrapping an external page in Wordpress template


No replies to this topic

#1 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 03 May 2007 - 08:48 AM

Today I installed Justin Blanton's excellent Smart Archives for WordPress plugin. I chose to install it as an external php page as described on Justin's Archives without using WordPress Pages page. After installing the plugin and creating the new "archives" directory and "archives/index.php" file as instructed, I noticed that the new plugin page was not using the Wordpress theme. The solution was simple and I post the code I used here in case anyone else wants to wrap an external page in the Wordpress template. The code below is specifically for the Smart Archives plugin but the general method should work for wrapping any external page in the Wordpress template.

<?php

require('../wp-blog-header.php');

get_header();
?>

<div id="content">
<h3 class="entrytitle"><a href="index.php">Archives</a></h3>

<?php
/*
Plugin Name: Smart Archives
Version: 1.9
Plugin URI: http://justinblanton.com/projects/smartarchives/
Description: A simple, clean, and future-proof way to present your archives.
Author: Justin Blanton
Author URI: http://justinblanton.com

"Type" is one of three values: block, list, or both. "Block" produces the block of years and months,1 "list" generates a reverse chronological list of your posts, including links to monthly archives, and "both" gives you the block and the list.
 
"Category ID" is simply the number of the category you want to exclude. If you want to exclude more than one category, simply put a space between them. Keep in mind that the "block" doesn't exclude categories. If you call the function with no arguments it will default to "both" and will exclude no categories. Some examples follow -- each is a proper invocation of the plugin. 

smartArchives('type','category ID');
*/

smartArchives('both','');

?>

</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users