Body tag in header AND template/footer?

Structure your theme so you start the <body> in the header and you close the </body> in the footer (same thing for the <html> tag): header.php <html> …header content <body> <!— body is started in the header, used on every page –> index.php, page.php, single.php, home.php – etc …content footer.php …footer content </body> <!– body … Read more

How to select a specific page

From WordPress Codex Get Posts. <?php $the_slug = ‘my_slug’; $args = array( ‘name’ => $the_slug, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘numberposts’ => 1 ); $my_posts = get_posts($args); if( $my_posts ) : echo ‘ID on the first post found ‘ . $my_posts[0]->ID; endif; ?> That way you can get a post or page by its … Read more

Using WPDB to output raw XML fails because of wp-blog-header.php

Include wp-load.php, not wp-blog-header.php. Better yet, hook onto the execution of a standard WordPress request and die early. isset( $_GET[‘my_conditional_check’] ) && add_action( ‘plugins_loaded’, ‘my_xml_output’ ); function my_xml_output() { // do my stuff exit; } This’ll run WordPress, then my_xml_output(), then die before the request is actually parsed & the template is loaded/rendered: http://example.com/?my_conditional_check