Skip to content

Commit

Permalink
Remove template_part, template_sidebar, temp sidebar fix
Browse files Browse the repository at this point in the history
  • Loading branch information
retlehs committed Mar 11, 2016
1 parent 67c190f commit abeea0f
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 35 deletions.
18 changes: 0 additions & 18 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@ function template_unwrap($slug = '', $context = []) {
}
}

/**
* @param array $context
*/
function template_sidebar($context = []) {
template_part('sidebar', $context);
}

/**
* @param $template
* @param array $context
*/
function template_part($template, $context = []) {
if ($file = (new Template($template, $context))->locate()) {
/** @noinspection PhpIncludeInspection */
include $file;
}
}

/**
* @param $filename
* @return string
Expand Down
2 changes: 1 addition & 1 deletion templates/404.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php App\template_part('partials/page-header'); ?>
<?php get_template_part('partials/page-header'); ?>

<div class="alert alert-warning">
<?php _e('Sorry, but the page you were trying to view does not exist.', 'sage'); ?>
Expand Down
4 changes: 2 additions & 2 deletions templates/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php App\template_part('partials/page-header'); ?>
<?php get_template_part('partials/page-header'); ?>

<?php if (!have_posts()) : ?>
<div class="alert alert-warning">
Expand All @@ -8,7 +8,7 @@
<?php endif; ?>

<?php while (have_posts()) : the_post(); ?>
<?php App\template_part('partials/content-' . (get_post_type() != 'post' ? get_post_type() : get_post_format())); ?>
<?php get_template_part('partials/content', get_post_type() != 'post' ? get_post_type() : get_post_format()); ?>
<?php endwhile; ?>

<?php the_posts_navigation(); ?>
8 changes: 4 additions & 4 deletions templates/layouts/base.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!doctype html>
<html <?php language_attributes(); ?>>
<?php App\template_part('partials/head'); ?>
<?php get_template_part('partials/head'); ?>
<body <?php body_class(); ?>>
<!--[if IE]>
<div class="alert alert-warning">
Expand All @@ -9,7 +9,7 @@
<![endif]-->
<?php
do_action('get_header');
App\template_part('partials/header');
get_template_part('partials/header');
?>
<div class="wrap container" role="document">
<div class="content row">
Expand All @@ -18,14 +18,14 @@
</main><!-- /.main -->
<?php if (App\display_sidebar()) : ?>
<aside class="sidebar">
<?php App\template_sidebar(); ?>
<?php get_template_part('partials/sidebar'); ?>
</aside><!-- /.sidebar -->
<?php endif; ?>
</div><!-- /.content -->
</div><!-- /.wrap -->
<?php
do_action('get_footer');
App\template_part('partials/footer');
get_template_part('partials/footer');
wp_footer();
?>
</body>
Expand Down
4 changes: 2 additions & 2 deletions templates/page.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php while (have_posts()) : the_post(); ?>
<?php App\template_part('partials/page-header'); ?>
<?php App\template_part('partials/content-page'); ?>
<?php get_template_part('partials/page-header'); ?>
<?php get_template_part('partials/content-page'); ?>
<?php endwhile; ?>
2 changes: 1 addition & 1 deletion templates/partials/content-search.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<article <?php post_class(); ?>>
<header>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php if (get_post_type() === 'post') { App\template_part('partials/entry-meta'); } ?>
<?php if (get_post_type() === 'post') { get_template_part('partials/entry-meta'); } ?>
</header>
<div class="entry-summary">
<?php the_excerpt(); ?>
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/content-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<article <?php post_class(); ?>>
<header>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php App\template_part('partials/entry-meta'); ?>
<?php get_template_part('partials/entry-meta'); ?>
</header>
<div class="entry-content">
<?php the_content(); ?>
Expand Down
2 changes: 1 addition & 1 deletion templates/partials/content.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<article <?php post_class(); ?>>
<header>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php App\template_part('partials/entry-meta'); ?>
<?php get_template_part('partials/entry-meta'); ?>
</header>
<div class="entry-summary">
<?php the_excerpt(); ?>
Expand Down
4 changes: 2 additions & 2 deletions templates/search.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php App\template_part('partials/header-page'); ?>
<?php get_template_part('partials/header-page'); ?>

<?php if (!have_posts()) : ?>
<div class="alert alert-warning">
Expand All @@ -8,7 +8,7 @@
<?php endif; ?>

<?php while (have_posts()) : the_post(); ?>
<?php App\template_part('partials/content-search'); ?>
<?php get_template_part('partials/content-search'); ?>
<?php endwhile; ?>

<?php the_posts_navigation(); ?>
2 changes: 1 addition & 1 deletion templates/single.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php App\template_part('partials/content-single-' . get_post_type()); ?>
<?php get_template_part('partials/content-single-' . get_post_type()); ?>
4 changes: 2 additions & 2 deletions templates/template-custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
?>

<?php while (have_posts()) : the_post(); ?>
<?php App\template_part('partials/page-header'); ?>
<?php App\template_part('partials/content-page'); ?>
<?php get_template_part('partials/page-header'); ?>
<?php get_template_part('partials/content-page'); ?>
<?php endwhile; ?>

0 comments on commit abeea0f

Please sign in to comment.