Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sometimes it's necessary to figure out CSS errors or whatever and then it's great if you have a minimal test page where you just insert the specific code you want to test.

How can I create such an empty test.php? All I could find was this. However, doing so will only create a page that will have the same styling as the page.php one, no?

I suppose I need to put something into my function.php to tell Wordpress that it should create a new template for test.php? How would I do that?

Thanks a lot in advance! :)

share|improve this question
1  
Simplest would be to create your page in the WordPress root directory and name it _test_page.php or something, and simply browse to it directly, http://yourwpsite.com/_test_page.php if WordPress is in the document root, you get the point. Does this solve your problem? –  soulseekah Oct 17 '11 at 4:03
add comment

1 Answer

up vote 2 down vote accepted

I usually do this for just code (no HTML):

add_action('template_redirect', 'test');

function test() {

    // code goes here

    die;
}

For dealing with HTML I prefer blank theme, set up for testing.

If you want to test in context of existing theme create custom page template, add/remove elements according to your needs and assign to test page.

share|improve this answer
    
Thank oyu for your answer. I want to mainly test HTML and CSS, so I would just switch to a blank theme instead? Wouldn't it be easier to create a blank test.php in my current theme? Basically I'm looking for the least complicated and fastest option to test HTML/CSS I want to use in my theme. –  japanworm Oct 18 '11 at 13:43
1  
@japanworm blank test.php does nothing by itself. If you want to test theme environment you need to load it appropriately. As per my answer custom page template is fitting option for that (unless putting together whole separate theme for debug purposes). –  Rarst Oct 18 '11 at 13:56
    
I think a custom page template is probably closest to what I'm looking for. I'll try it out. Thanks a lot! :) –  japanworm Oct 18 '11 at 13:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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