I'm trying to create a custom page template, but the code in the page.php file in theme I'm using is not what I've experienced before.
TL;DR: Is there a name to this type of code/coding?
I usually am able to simply add in HTML in the body of the php file, but everything is looped (?) in here, and I'm not sure how to add any HTML in.
Because I don't know what to Google, I don't know how to figure this out or where to even start.
Here's the code from the page.php file:
<?php /* Template Name: Custom Template Name */
get_header();
list($masters_layout) = theme_page_layout_scheme();
echo '<!--_____ Start Content ____ -->' . "
";
if ($masters_layout == 'r_sidebar') {
echo '<div class="content entry" >' . "
\t";
} elseif ($masters_layout == 'l_sidebar') {
echo '<div class="content entry fr" >' . "
\t";
} else {
echo '<div class="middle_content entry" >';
}
if (have_posts()) : the_post();
$content_start = substr(get_post_field('post_content', get_the_ID()), 0, 15);
if ($masters_layout == 'fullwidth' && $content_start === '[masters_row') {
echo '</div>' .
'</div>';
}
the_content();
echo '<div class="cl"></div>';
if ($masters_layout == 'fullwidth' && $content_start === '[masters_row') {
echo '<div class="content_wrap ' . $masters_layout .
((is_singular('project')) ? ' project_page' : '') .
((is_singular('profile')) ? ' profile_page' : '') .
'">' . "
" .
'<div class="middle_content entry" >';
}
wp_link_pages(array(
'before' => '<div class="subpage_nav" >' . '<strong>' . esc_html__('Pages', 'themename') . ':</strong>',
'after' => '</div>' . "
",
'link_before' => ' [ ',
'link_after' => ' ] '
));
comments_template();
endif;
echo '</div>' . "
" .
'<!-- _____ Finish Content _____ -->' . "
";
get_footer();
I'm used to seeing closed tags(?) and HTML thrown in there. For example:
<?php /* Template Name: Custom Template Name */ ?>
<?php get_header(); ?>
<!-- start content container -->
<div class="container">
<div class="row dmbs-content">
<?php //left sidebar ?>
<div class="main-content">
<?php // theloop
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2 class="page-header"><?php the_title() ;?></h2>
<?php the_content(); ?>
<?php wp_link_pages(); ?>
<?php comments_template(); ?>
<?php endwhile; ?>
<?php else: ?>
<?php get_404_template(); ?>
<?php endif; ?>
</div>
<?php //get the right sidebar ?>
</div>
</div>
<!-- end content container -->
<?php get_footer(); ?>
Any help is appreciated!