Ryan Posted May 21, 2009 Posted May 21, 2009 I've been looking around for plugins that would let me execute php on static pages in wordpress 2.7 and i found php-exec but the php is being removed after the page is loaded a few times. so i finally decided that the best what to go is probably to create a page outside of wordpress and use includes to bring the theme to the new page however since i am a total noob with php and wordpress i am not sure exactly how to do this. anyone have any thoughts? Quote
Loony Guitarist Posted May 22, 2009 Posted May 22, 2009 insert this code in or before the <head></head> section of the page and it should load all your wordpress stuff. you can even use the functions. <?php /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php'); ?> just make sure that './wp-blog-header.php' reflects the location of that file on your server. Example: './wordpress/wp-blog-header.php' Quote
Ryan Posted May 22, 2009 Author Posted May 22, 2009 insert this code in or before the <head></head> section of the page and it should load all your wordpress stuff. you can even use the functions. <?php /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php'); ?> just make sure that './wp-blog-header.php' reflects the location of that file on your server. Example: './wordpress/wp-blog-header.php' thanks did that but it still wont load the page just displays the html nothing else. i store the pages that i created in a separate folder so i con get confused with the wp stuff. <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>KCCS: Error</title> <?php /** Loads the WordPress Environment and Template */ require('../wp-blog-header.php'); ?> </head> <body> <h1 align="center"> OOPS! There was a problem with sending your message. Please try again later.</h1> <p align="center"><img src="kccs logo.jpg" alt="Logo" /></p> <br/> <h2 align="center"> Sorry KCCS Admin Team</h2> </body> </html> Quote
Loony Guitarist Posted May 22, 2009 Posted May 22, 2009 Oops... my bad forgot the calls to your theme. it should look like this. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>KCCS: Error</title> <?php /** Loads the WordPress Environment and Template */ require('../wp-blog-header.php'); ?> <?php get_header(); ?> </head> <body> <h1 align="center"> OOPS! There was a problem with sending your message. Please try again later.</h1> <p align="center"><img src="kccs logo.jpg" alt="Logo" /></p> <br/> <h2 align="center"> Sorry KCCS Admin Team</h2> <?php get_sidebar(); ?> <?php get_footer(); ?> </body> </html> require('./wp-blog-header.php'); <- just makes your page aware of wordpress but doesn't actually load anything <?php get_header(); ?> <- fetches the current template's header file which will display your header <?php get_sidebar(); ?> <- Fetches your sidebar if you want delete it if you dont <?php get_footer(); ?> <- gets the themes footer template just like the header. Quote
Ryan Posted May 22, 2009 Author Posted May 22, 2009 thanks a lot works great even pulls in the style sheets for the divs Quote
Loony Guitarist Posted May 26, 2009 Posted May 26, 2009 thanks a lot works great even pulls in the style sheets for the divs No problem. Wordpress is brilliant... especially when you start using some of the plugins that are out their for it. I only wish I had found it sooner then I did. Quote
Ryan Posted June 24, 2009 Author Posted June 24, 2009 No problem. Wordpress is brilliant... especially when you start using some of the plugins that are out their for it. I only wish I had found it sooner then I did. ok so now i have a new issue. when i add the external links to the header file it still re-directs me to the root page of the blog or sometimes it thinks the link is a sub directory of the blog snd i end up with this http://kingscountycomputersolutions.com/ki...act/contact.php here is the header file <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> ยป Blog Archive <?php } ?> <?php wp_title(); ?></title> <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats --> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <?php wp_head(); ?> </head> <body> <div id="bg"> <div id="mainpage"> <div id="header"> <div class="title"> <h1><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1> <h2><?php bloginfo('description'); ?></h2> </div> <div class="toprss"> <a href="<?php bloginfo('url'); ?>?feed=rss2"><img alt="RSS" src="<?php bloginfo('url'); ?>/wp-content/themes/Rebel/images/rss.gif"/></a> </div> <div id="search"> <?php include (TEMPLATEPATH . '/searchform.php'); ?> </div> </div> <div id="menu"> <ul class="menu"><li><a href="<?php bloginfo('url'); ?>"Home</a></li> <?php wp_list_pages('title_li=' ); ?> <li> <a href="http://kingscountycomputersolutions.com/about.php">About Us </a> </li> <li><a href="kingscountycomputersolutions.com/contact/contact.php">Contact Us</a></li> </ul> </div> <div id="main"> any idea as to whats wrong? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.