separated loop for singular templates

This commit is contained in:
Leo Germani 2018-04-16 09:46:54 -03:00
parent 96fbea6f3d
commit 5ea0419bc2
4 changed files with 26 additions and 13 deletions

View File

@ -3,7 +3,7 @@
<div class="col-sm">
<div id="content" role="main">
<?php get_template_part('template-parts/loop'); ?>
<?php get_template_part('template-parts/loop', 'singular'); ?>
</div><!-- /#content -->
</div>
</div><!-- /.row -->

View File

@ -2,7 +2,7 @@
<div class="row">
<div class="col col-sm-9 mx-sm-auto">
<div id="content" role="main">
<?php get_template_part('template-parts/loop'); ?>
<?php get_template_part('template-parts/loop', 'singular'); ?>
</div><!-- /#content -->
</div>
</div><!-- /.row -->

View File

@ -0,0 +1,19 @@
<?php if(have_posts()): ?>
<?php while(have_posts()): the_post(); ?>
<div class="tainacan-title">
<div class="border-bottom border-jelly-bean tainacan-title-page" style="border-width: 2px !important;">
<ul class="list-inline mb-1">
<li class="list-inline-item text-midnight-blue font-weight-bold">
<?php the_title(); ?>
</li>
<li class="list-inline-item float-right"><a href="javascript:history.go(-1)"><?php _e('Back'); ?></a></li>
</ul>
</div>
</div>
<div class="mt-3 tainacan-single-post">
<?php get_template_part('template-parts/single-post'); ?>
</div>
<?php endwhile; ?>
<?php else: ?>
<?php _e('Nothing found', 'tainacan-theme'); ?>
<?php endif; ?>

View File

@ -5,7 +5,6 @@
<li class="list-inline-item text-midnight-blue font-weight-bold">
<?php
if(is_home()) echo 'Blog';
elseif(is_single() || is_page()) the_title();
elseif(is_search()){
_e('Search Results for', 'tainacan-theme');
echo ' ' . the_search_query();
@ -19,19 +18,14 @@
</ul>
</div>
</div>
<div class="<?php if(is_home() || is_search() || is_category() || is_archive()) echo 'mt-5 tainacan-list-post'; elseif(is_single() || is_page()) echo 'mt-3 tainacan-single-post'; ?>">
<div class="mt-5 tainacan-list-post">
<?php while(have_posts()):
the_post();
//List Post
if(is_home() || is_search() || is_category() || is_archive()){
get_template_part('template-parts/list-post');
}
//View Post
elseif(is_single() || is_page()){
get_template_part('template-parts/single-post');
} else {
printf('<p>%2</p>', __('Sorry, no posts matched your criteria.', 'tainacan-theme'));
}
get_template_part('template-parts/list-post');
endwhile; ?>
</div>
<?php echo tainacan_pagination(3); ?>