I have a theme installed in wordpress like this directory /wp-content/themes/mytheme so in the root I have custom code which is little complex and easy to integrate in wordpress theme so I want to finding an option where I can use header.php and footer.php in root directory like this way. /custom_code/custom.php
2 Answers
After a lot of searching here is the solution.
<?php require('../wp-blog-header.php'); ?>
<?php get_header(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo
('charset'); ?>" />
<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php
wp_title(); ?></title>
<?php wp_head(); ?>
</head>
<body>
It works!
</body>
</html>
<?php get_footer(); ?>
3 Comments
Xander Luciano
Shouldn't you include the header after the <head> tag?
And It Works! should be <p>It Works!</p>Developer_world
@ViperCode why should not include after header any specific reason I want to add some JS files in newer files then how I can?
Xander Luciano
Whichever one has the HTML in it should come after the
</head> tag. All your scripts should be included in the <head></head>Include header.php and footer.php like this: http://codex.wordpress.org/Integrating_Wordpress_with_Your_Website
From the page:
<?php
/* Short and sweet */
define('WP_USE_THEMES', false);
require('./wp-blog-header.php');
?>
require('/path/to/file/in/wp/dir/header.php');