admin管理员组

文章数量:1291109

I am writing a custom php script and want to load the theme so it will look like a regular page. I tried the following.

<?php
define( 'WP_USE_THEMES', true );
require( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );

$str = '';

get_header();

$str .= '<div id="primary" class="content-area">';
$str .= '<main id="main" class="site-main" role="main">';

$str .= 'Hello world';

$str .= '</main>';
$str .= '</div>';

echo $str;

get_footer();
?>

It shows the header and footer. However the content appears without borders/margins. A regular page on the site has borders/margins. This one does not.

I could style this page by hand so it matches a regular page. However I am trying to avoid doing it, because I want it to change with the theme.

Any suggestions on how I can get this page styled like a regular page on the site?

Thanks.

本文标签: cssWordpress custom php script to match standard page layout