Wordpress custom php script to match standard page layout
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.
Topic wp-load.php php css Wordpress
Category Web