how can i redirect to my php pages in my themes? i tried this, but i get errors:
<meta HTTP-EQUIV="refresh" content=0;url="../../wp-content/themes/default/testing.php">
how can i redirect to my php pages in my themes? i tried this, but i get errors:
<meta HTTP-EQUIV="refresh" content=0;url="../../wp-content/themes/default/testing.php">
Use Php's header function.
<?php
$theme_location = "../../wp-content/themes/default/testing.php";
header("Location: $theme_location");
?>
Used the variable as it helps clean code up as i think so. Using a long url in a header() is very hard to understand.
ssbansal,
ok, i put that and i get this error:
Warning: Cannot modify header information - headers already sent by (output started at /homepages/38/htdocs/wp-content/themes/default/testing.php:7) in /homepages/38/htdocs/wp-content/themes/default/testing.php on line 21
ideas?
nevermind, moved it to the top and it forwards, but i get the same thing as the HTTP-EQUIV="refresh"
Fatal error: Call to undefined function get_header() in /homepages/38/htdocs/wp-content/themes/default/testing.php on line 1
get_header() is a function that isn't in any of the theme files. Either it hasn't been included or it has been called wrong.
Look in the themes PHP files for:
function get_header()
this was already in the top of the testing.php page
<?php get_header(); ?>
shouldn't this work?
get_header is a built-in WP template function.
If you link directly to that file, no it won't run since WP hasn't been initialized.
Instead, make testing.php a custom page template (see the codex), then create a page in wp-admin, use testing.php as the template, and then redirect to that pages permalink.
"Warning: Cannot modify header information - headers already sent by (output started at "
Put your header(Location call at the very top of the file redirecting, before the html output.
The top of that file would look similar to:
<?php
if ( something ) {
header...
}
?>
<DOCTYPE...
that makes sense. so if you ever want to link or redirect to a theme page "directly" that has WP functions, you have to do it through templates.
that assumption correct?
That's the easiest way, yes.
You can make custom pages, initialize WP yourself, etc. but it's easier for a single blog to do it that way.
Make a page, use a custom template, do what you want in the template.
i like easy! thanks again :)