Site logo

Archived topic

Custom page template

3 replies · Started by Anders on April 15, 2021

Viewing posts 1–4 of 4

Hi,

I'm building a site where I will let certain external sites include specific content on their own site via iframe. So I need a "minimalistic" custom page template where I can construct the content from shortcodes and php conditions (GeoDirectory based). I'm using a GP child theme where I load this page template through add_filter('template_include'...), based on a get_query_var condition.
Now, I actually already have this working exactly the way I need it to, but I was wondering if you could just take a quick look at my custom GP page template here so I'm not missing anything. Basically I copied page.php, footer.php and header.php deleted everything except essentials and merged into one file:

<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package GeneratePress
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<link rel="profile" href="https://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>

<body <?php body_class(); ?> <?php generate_do_microdata( 'body' ); ?>>

Here I display shortcodes based on custom functions and conditions

<?php
wp_footer();
?>
</body>
</html>

Thanks!

Hi there,

that looks perfectly fine to me!

Great to hear, thank you!

You're welcome

This archived topic is closed to new replies.