Create a Genesis Page Outside of WordPress

Some time back I provided code that would permit you to use the WordPress header and footer (and associated functionality associated with the WordPress framework) outside of WordPress. Unfortunately, it doesn’t work with the Genesis framework.

When you build pages ‘outside’ of WordPress, you retain full access to the framework’s core features including navigation and the shortcode API. The following code will render your default Genesis sidebars… and you’ll retain all the features and functions associated with both WordPress and Genesis (with the added feature of being able to natively execute PHP code).

The Code

The following is very basic code. Download the code below to see sample shortcode and PHP usage.

<?php
require( '../wp-load.php' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'internoetics_page' );

/* You can remove breadcrumbs with the following function
   remove_action('genesis_before_loop', 'genesis_do_breadcrumbs');
*/

// The following will change the breadcrumb of 'home' to whatever you choose to define
add_filter( 'genesis_breadcrumb_args', 'child_breadcrumb_args' );
function child_breadcrumb_args( $args ) {
	$args['home'] = 'Home';
	return $args;
}

// The following will change the breadcrumb home URL
add_filter ( 'genesis_home_crumb', 'child_amend_home_breadcrumb_link' );
function child_amend_home_breadcrumb_link( $crumb ) {    
	return preg_replace('/href="[^"]*"/', 'href="http://www.YourDomain.com/Whatever-you-like/"', $crumb);
}


function internoetics_page() { ?>

<h1 class="entry-title">Example Genesis Page Outside WordPress</h1>
<div class="entry-content">

This is text content...

</div>

<?php
}
genesis();
?>

You can see an example of the Genesis Page here.

Usage

The genesis page is ready to rock and roll. Just download the code below and upload it to your web server. The only change you’ll have to make is on line two that reads: require( '../wp-load.php' );. This has to reference the wp-load.php file. If the page is in the same directory as wp-load.php, it will be simply require( 'wp-load.php' );

First Name:
Your Email Address:
 




Download: Create a Genesis Page outside of WordPress
Description: Create a Genesis Page outside of WordPress
Author:Marty
Category: PHP code
Date: July 18, 2012



If you liked this article, you may also like:

  1. Add the WordPress Header and Footer, and Utilise the Features of WP on a non-WordPress Page
  2. Create a WordPress Author Bio with Custom Social Links
  3. Create a WordPress Gallery from all Images in a Directory (Using TimThumb)
  4. Add a Facebook Like Box to WordPress (with and without Shortcode)
  5. PHP Function to Create Keyword Tags from Text
About Marty

is a passionate web developer from Sydney, Australia. He owns about 600 websites and makes a healthy living from working the web. As a day job, he works as a pilot for an international airline. Follow Marty on Twitter or Google+.

Speak Your Mind

*