A theme I am developing depends on there being a static front page. However, there seems to only be one global option to change if front page is static. So when I go to preview the theme, it won't work because the front-page option is off. But I don't want to change the front-page option because the live site will be affected.

Is there a way to change that setting only when certain themes are being viewed?


You can try the Theme Test Drive plugin to help you preview a development copy of your theme while a live site is still fully functional.

Assuming it's the same theme you are working on (as it sounds like it) - you can copy the existing theme to a new theme folder, and just change the Theme Name value in the style.css in the development copy... then activate a preview for this theme via the Theme Test Drive page, or simply use:

?theme=new-name in the URL for any page. ('New Name' becomes 'new-name')

This is probably better than playing with the existing live theme as depending on the template you're editing a typo could have a rather disastrous effect of the live end, or a template might be used somewhere else so you may want to check that too (eg. index.php is a fallback template, so using it like this may or may not be a good idea.)

* index.php
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy

Anyway, when you're satisfied with the development version, change the style.css Theme Name back to the original in the development copy, and rename the theme folders via FTP to quickly "switch in" the theme development copy to the existing theme folder name.

/wp-content/themes/live-theme/ -> /wp-content/themes/backup-theme/
/wp-content/themes/new-theme/ -> /wp-content/themes/live-theme/

(I do it this way because it's faster, and also so you don't have to reconfigure the existing sidebar widgets for the 'new' theme - not always it seems, but sometimes they can get 'lost' or become 'inactive' if you 'activate' the new theme copy as they are associated with the existing one. You can do a similar trick for theme updates if you want to be safer with them.)

Then check the live site is okay, and if not switch the folders back immediately and keep on trucking, err, I mean developing...

I recently did a more step-by-step instruction regarding using the Theme Test Drive plugin on my own theme framework's documentation page if that helps further: Muscle Flex Docs


What I did was this: I just manually coded index.php to be a copy/paste of page.php, pulled the right page from the DB, and echo'ed the content. A code snippet below:

<?php $main_page = get_page_by_title( 'What We Do' ); ?>
<h1><center><?php echo $main_page->post_title; ?></center></h1>

<?php echo $main_page->post_content; ?>

This way my theme works regardless of the front_page options. I realize my code snippet may have details that can be improved, but the spirit of the idea is what I needed to get first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.