Custom Template

Template files together with Twitter Bootstrap are the building blocks of your WordPress site. They fit together like the pieces of a puzzle to generate the web pages on your site, define layout type. Some templates (the header and footer template files for example) are used on all the web pages, while others are used only under specific conditions.

WordPress Template System

WordPress custom page templates are theme files that provide an alternative to the default page.php file. These custom templates can contain whatever HTML and template tags you wish to build your desired layout or content, then the file can be attached to a specific page in order for WordPress to use this new template when serving that particular page of the site.

Default Directory Structure

To order all files and keep theme directory clean we advice you to store custome templates inside /templates directory and add word/numeral prefix before filename, for example 01-example.php or template-example.php

Another part - is view, view located in specific directory. In this part we'll puts all important things about content section, including content. Views directory located inside theme framework directory /framework/view and separated on different views and modules.

  • /containers - pre-containers for custom content types.
  • /loops - elements for loops (feeds)
  • /single - single conteiner parts
  • /modules - site-specific modules
  • /buddypress - here we store all template content part for buddypress plugins

The WordPress Page Structure

A simple WordPress web page structure is made up of three basic building "blocks": a header, the content, and a footer. Each of these blocks is generated by a template file in your current WordPress Theme.



The header contains all the information that needs to be at the top — i.e. inside the tag — of your XHTML web page, such as the , tags and links to style sheets. It also includes the opening tag and the visible header of your blog (which typically includes the title of your site, and may also include navigation menus, a logo bar, the description of your site, etc.).

The content block contains the posts and pages of your blog, i.e. the "meat" of your site.

The footer contains the information that goes at the bottom of your page, such as links to other Pages or categories on your site in a navigation menu, copyright and contact information, and other details.

Irish Framework Structure

Irish Miss framework works with all WP hooks to push and create new features. This is important things that allow built theme before content will be displayer (we call rendered content).

All content in our templates generating with additional layout class to put content into the bootstrap grid and deffine page layout type (left, right or fullwidth). Class miss_page_layout located inside /framework/classes/layout.php

Create View Part

/framework/views/single/single-example.php
<?php
// Verifying if content not empty
if ( have_posts() ) while ( have_posts() ) : the_post();
  $_page_content = get_the_content();
  if ( !empty( $_page_content ) ) :
?>
<!-- Content Area -->
  <div class="single_module <?php echo get_post_type(); ?>">
    <div id="page-<?php the_ID(); ?>" <?php post_class(); ?>>
      <div class="single_content">
        <?php miss_before_entry(); ?>
        <div class="post_excerpt">
          <?php
          if (miss_get_setting('review') == 'enable') {
            echo the_score($post->ID); 
          }
          ?>
          <?php the_content(); ?>
          <div class="clearboth"></div>
          <?php wp_link_pages( array( 'before' => '<div class="page_link">' . __( 'Pages:', MISS_TEXTDOMAIN ), 'after' => '</div>' ) ); ?>
          <?php edit_post_link( __( 'Edit entry', MISS_TEXTDOMAIN ), '<div class="edit_link">', '</div>' ); ?>
          </div><!-- .entry -->
         <div class="clearboth"></div>
       <?php miss_after_entry(); ?>
      </div><!-- .single_page_content -->
    </div><!-- #page-## -->
  </div><!-- .single_page_module -->
<!-- / Content Area -->
  <?php endif; ?>
<?php endwhile; ?>
Note:Please don't use get_header() and get_footer() inside views

Create template file

/templates/template-example.php
<?php
/*
Template Name: Example Template
*/

// Call WP header
get_header();

$layout = new miss_page_layout($layout = miss_page_layout(), $location = 'views/single', $type = 'single', $template = get_post_type() );
$layout->miss_render_page_layout();

// Call WP footer
get_footer();
?>

What miss_page_layout does