ADD loop on index and single with sidebar.
This commit is contained in:
parent
3a7007ba71
commit
a7e9b574a3
|
@ -24,3 +24,21 @@ if(!function_exists('tainacan_setup')) {
|
||||||
|
|
||||||
}
|
}
|
||||||
add_action( 'after_setup_theme', 'tainacan_setup' );
|
add_action( 'after_setup_theme', 'tainacan_setup' );
|
||||||
|
|
||||||
|
if ( ! function_exists( 'tainacan_post_date' ) ) {
|
||||||
|
function tainacan_post_date() {
|
||||||
|
if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
|
||||||
|
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
|
||||||
|
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
||||||
|
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time> <time class="updated" datetime="%3$s">(updated %4$s)</time>';
|
||||||
|
}
|
||||||
|
$time_string = sprintf( $time_string,
|
||||||
|
esc_attr( get_the_date( 'c' ) ),
|
||||||
|
get_the_date(),
|
||||||
|
esc_attr( get_the_modified_date( 'c' ) ),
|
||||||
|
get_the_modified_date()
|
||||||
|
);
|
||||||
|
echo $time_string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
<?php get_header(); ?>
|
<?php get_header(); ?>
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row p-2">
|
<div class="col-sm">
|
||||||
|
<div id="content" role="main">
|
||||||
<?php get_template_part( 'template-parts/loop' ); ?>
|
<?php get_template_part('template-parts/index-loop'); ?>
|
||||||
|
</div><!-- /#content -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,17 @@
|
||||||
<?php
|
<?php get_header(); ?>
|
||||||
|
|
||||||
get_header();
|
<div class="container-fluid mt-5">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
get_template_part('template-parts/loop');
|
<div class="col-sm">
|
||||||
|
<div id="content" role="main">
|
||||||
|
<?php get_template_part('template-parts/single-post', get_post_format()); ?>
|
||||||
|
</div><!-- /#content -->
|
||||||
|
</div>
|
||||||
|
|
||||||
get_footer();
|
<?php get_sidebar(); ?>
|
||||||
|
|
||||||
|
</div><!-- /.row -->
|
||||||
|
</div><!-- /.container-responsive -->
|
||||||
|
|
||||||
|
<?php get_footer(); ?>
|
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
<div class="<?php if(!is_single()) : echo 'card-columns'; endif; ?>">
|
<div class="<?php if(!is_single()) : echo 'card-columns'; endif; ?> mt-3">
|
||||||
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="card w-100">
|
<div class="card w-100">
|
||||||
<h5 class="card-header"><?php the_title(); ?></h5>
|
<h5 class="card-header"><?php the_title(); ?></h5>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p class="card-text"><?php if(is_single()) : the_content(); else : the_excerpt(); endif; ?></p>
|
<p class="card-text"><?php if(is_single()) : the_content(); else : the_excerpt(); endif; ?></p>
|
||||||
<a href="<?php the_permalink(); ?>" class="btn btn-primary">Go somewhere</a>
|
<a href="<?php the_permalink(); ?>" class="btn btn-primary">View more</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php if(have_posts()): while(have_posts()): the_post(); ?>
|
||||||
|
<article role="article" id="post_<?php the_ID()?>" <?php post_class()?>>
|
||||||
|
<header class="mb-4">
|
||||||
|
<h1>
|
||||||
|
<?php the_title()?>
|
||||||
|
</h1>
|
||||||
|
<div class="header-meta text-muted">
|
||||||
|
<?php
|
||||||
|
_e('By ', 'tainacan');
|
||||||
|
the_author_posts_link();
|
||||||
|
_e(' on ', 'tainacan');
|
||||||
|
tainacan_post_date();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<?php
|
||||||
|
the_post_thumbnail();
|
||||||
|
the_content();
|
||||||
|
wp_link_pages();
|
||||||
|
?>
|
||||||
|
</main>
|
||||||
|
<footer class="mt-5 border-top pt-3">
|
||||||
|
<p>
|
||||||
|
<?php _e('Category: ', 'b4st'); the_category(', ') ?> | <?php if (has_tag()) { the_tags('Tags: ', ', '); ?> | <?php } _e('Comments', 'b4st'); ?>: <?php comments_popup_link(__('None', 'b4st'), '1', '%'); ?>
|
||||||
|
</p>
|
||||||
|
<div class="author-bio media border-top pt-3">
|
||||||
|
<?php get_avatar(); ?>
|
||||||
|
<div class="media-body ml-3">
|
||||||
|
<p class="h4 author-name"><?php the_author_posts_link(); ?></p>
|
||||||
|
<p class="author-description"><?php the_author_description(); ?></p>
|
||||||
|
<p class="author-other-posts mb-0 border-top pt-3"><?php _e('Other posts by ', 'b4st'); the_author_posts_link(); ?></p>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.author-bio -->
|
||||||
|
</footer>
|
||||||
|
</article>
|
||||||
|
<?php
|
||||||
|
if ( comments_open() || get_comments_number() ) :
|
||||||
|
comments_template();
|
||||||
|
endif;
|
||||||
|
endwhile; else:
|
||||||
|
wp_redirect(esc_url( home_url() ) . '/404', 404);
|
||||||
|
exit;
|
||||||
|
endif;
|
||||||
|
?>
|
||||||
|
<div class="row mt-5 border-top pt-3">
|
||||||
|
<div class="col">
|
||||||
|
<?php previous_post_link('%link', '<i class="fas fa-fw fa-arrow-left"></i> Previous post: '.'%title'); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col text-right">
|
||||||
|
<?php next_post_link('%link', 'Next post: '.'%title' . ' <i class="fas fa-fw fa-arrow-right"></i>'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
Reference in New Issue