Jump to content

Wordpress


Ryan

Recommended Posts

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?

Link to comment
Share on other sites

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.

&lt;?php /** Loads the WordPress Environment and Template */
require('./wp-blog-header.php'); ?&gt;

just make sure that './wp-blog-header.php' reflects the location of that file on your server.

Example: './wordpress/wp-blog-header.php'

Link to comment
Share on other sites

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.

&lt;?php /** Loads the WordPress Environment and Template */
require('./wp-blog-header.php'); ?&gt;

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.

&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;KCCS: Error&lt;/title&gt;

&lt;?php /** Loads the WordPress Environment and Template */
require('../wp-blog-header.php'); ?&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;h1 align="center"&gt; OOPS! There was a problem with sending your message. Please try again later.&lt;/h1&gt;
&lt;p align="center"&gt;&lt;img src="kccs logo.jpg" alt="Logo" /&gt;&lt;/p&gt;
&lt;br/&gt;
&lt;h2 align="center"&gt; Sorry KCCS Admin Team&lt;/h2&gt;
&lt;/body&gt;
&lt;/html&gt;

Link to comment
Share on other sites

Oops... my bad forgot the calls to your theme. it should look like this.

&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;KCCS: Error&lt;/title&gt;

&lt;?php /** Loads the WordPress Environment and Template */
require('../wp-blog-header.php'); ?&gt;
&lt;?php get_header(); ?&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;h1 align="center"&gt; OOPS! There was a problem with sending your message. Please try again later.&lt;/h1&gt;
&lt;p align="center"&gt;&lt;img src="kccs logo.jpg" alt="Logo" /&gt;&lt;/p&gt;
&lt;br/&gt;
&lt;h2 align="center"&gt; Sorry KCCS Admin Team&lt;/h2&gt;
&lt;?php get_sidebar(); ?&gt;
&lt;?php get_footer(); ?&gt;
&lt;/body&gt;
&lt;/html&gt;

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.

Link to comment
Share on other sites

  • 5 weeks later...
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

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head profile="http://gmpg.org/xfn/11"&gt;
&lt;meta http-equiv="Content-Type" content="&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php bloginfo('charset'); ?&gt;" /&gt;
&lt;title&gt;&lt;?php bloginfo('name'); ?&gt; &lt;?php if ( is_single() ) { ?&gt; » Blog Archive &lt;?php } ?&gt; &lt;?php wp_title(); ?&gt;&lt;/title&gt;
&lt;meta name="generator" content="WordPress &lt;?php bloginfo('version'); ?&gt;" /&gt; &lt;!-- leave this for stats --&gt;
&lt;link rel="stylesheet" href="&lt;?php bloginfo('stylesheet_url'); ?&gt;" type="text/css" media="screen" /&gt;
&lt;link rel="alternate" type="application/rss+xml" title="&lt;?php bloginfo('name'); ?&gt; RSS Feed" href="&lt;?php bloginfo('rss2_url'); ?&gt;" /&gt;
&lt;link rel="pingback" href="&lt;?php bloginfo('pingback_url'); ?&gt;" /&gt;
&lt;?php wp_head(); ?&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="bg"&gt;
&lt;div id="mainpage"&gt;


&lt;div id="header"&gt;
&lt;div class="title"&gt;
&lt;h1&gt;&lt;a href="&lt;?php bloginfo('url'); ?&gt;"&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/a&gt;&lt;/h1&gt;
&lt;h2&gt;&lt;?php bloginfo('description'); ?&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="toprss"&gt;
&lt;a href="&lt;?php bloginfo('url'); ?&gt;?feed=rss2"&gt;&lt;img alt="RSS" src="&lt;?php bloginfo('url'); ?&gt;/wp-content/themes/Rebel/images/rss.gif"/&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;div id="search"&gt;
&lt;?php include (TEMPLATEPATH . '/searchform.php'); ?&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div id="menu"&gt;
&lt;ul class="menu"&gt;&lt;li&gt;&lt;a href="&lt;?php bloginfo('url'); ?&gt;"Home&lt;/a&gt;&lt;/li&gt;
 &lt;?php wp_list_pages('title_li=' ); ?&gt;
&lt;li&gt; &lt;a href="http://kingscountycomputersolutions.com/about.php"&gt;About Us &lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="kingscountycomputersolutions.com/contact/contact.php"&gt;Contact Us&lt;/a&gt;&lt;/li&gt;

&lt;/ul&gt;
&lt;/div&gt;

&lt;div id="main"&gt;

any idea as to whats wrong?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...