views:

612

answers:

3

I tried adding a frontpage.php file to the content directory, but that wasn't being loaded. Now, I've added the following snippet to assure I'm getting a context of 'frontpage':

add_filter('cfct_context', 'scompt_front_page_context');

function scompt_front_page_context($context) {
    if( is_front_page() )
     return 'frontpage';
    return $context;
}

That's allowing me to create a frontpage.php file in the loop directory, but I'm still unable to get it to use a my file for the content.

+1  A: 

Not exaclty sure what you're trying to do, but in order to use a page template in Wordpress, you must have this at the top of the file:

<?php
/*
Template Name: mypage
*/
?>

and that goes before

<?php get_header(); ?>

And in order for Wordpress to use the template, you have to select it in the page editing area in admin.

So, for a "frontpage," use a template named home.php - with the template name as above - and select it as the template to use in the page editor.

songdogtech
A: 

The index.php file is used on the front page of your wordpress blog. Edit (or create) the index.php file to make changes for the front page of your blog.

dave elkins
+1  A: 

you need two pages to get this to work.

  1. page_example.php (make newfile in same directory as page.php)

  2. pages/page_example.php (copy and rename page_default.php)

page_example.php must have this header only

<?php
/*
Template Name: Page example
*/

if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die(); }
if (CFCT_DEBUG) { cfct_banner(__FILE__); }

cfct_page('page_example');

?>

and

pages/page_example.php is the page it calls so really all your changes need to be in here. ie remove the side bar, get_sidebar();

now select this page as usual when you are creating a page.