Skip to content
This repository was archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
Category and Author Pages added
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorakal committed Aug 2, 2021
1 parent aeceb0b commit 1bb77d4
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 3 deletions.
96 changes: 96 additions & 0 deletions author.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,103 @@
$container = get_theme_mod( 'understrap_container_type' );
?>

<header id="inner-header">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="header-caption">
<h1><?php the_author(); ?></h1>
</div>
<!-- /.header-caption -->
</div>
<!-- /.col-md-12 -->
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</header>

<div id="blogs">
<div class="blog-items section-area">
<div class="container">
<div class="row">
<div class="col-md-12">

<?php


while(have_posts()): the_post(); ?>

<div class="blog-item">
<div class="row">
<div class="col-md-5">
<div class="blog-photo">
<a href="<?php echo get_permalink(); ?>">
<?php
$values = get_field( 'featured_image_blog' );
if ( $values ) { ?>
<?php
$imageID = get_field('featured_image_blog');
$image = wp_get_attachment_image_src( $imageID, 'blogthumb-image' );
$alt_text = get_post_meta($imageID , '_wp_attachment_image_alt', true);
?>

<img class="img-responsive" alt="<?php echo $alt_text; ?>" src="<?php echo $image[0]; ?>" />
<?php
} else { ?>
<img src="<?php bloginfo('template_directory'); ?>/img/misc/placeholder.jpg" alt="">
<?php } ?>

<i class="fal fa-image"></i>
</a>
</div>
<!-- /.blog-photo-->
</div>
<!-- /.col-md-5 -->
<div class="col-md-7">
<div class="blog-content">
<div class="blog-meta">
<?php $author_id = get_the_author_meta( 'ID' ); ?>
<span><a href="<?php echo get_author_posts_url($author_id); ?>"><?php the_author_meta( 'display_name', $author_id ); ?> </a></span>

<span>
<?php
global $post;
$categories = get_the_category($post->ID);
$cat_link = get_category_link($categories[0]->cat_ID);
echo '<a href="'.$cat_link.'">'.$categories[0]->cat_name.'</a>'
?>
</span>
<span><a href="javascript:;"><?php echo get_the_date( 'F j, Y' ); ?></a></span>
</div>
<!-- /.category -->
<h2><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_field('excerpt_text'); ?>
<a href="<?php echo get_permalink(); ?>" class="read-more">Read More</a>
</div>
<!-- /.blog-content -->
</div>
<!-- /.col-md-7 -->
</div>
<!-- /.row -->
</div>

<?php endwhile; ?>

<nav class="pagination-block">
<?php if( function_exists('wp_pagenavi') ) wp_pagenavi(); // WP-PageNavi function ?>
</nav>

</div>
<!-- /.col-md-12 -->
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</div>
<!-- /.blog-items -->
</div>
<!-- /#blogs -->

<?php
get_footer();
98 changes: 97 additions & 1 deletion category.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,101 @@
<?php get_header(); ?>


<header id="inner-header">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="header-caption">
<h1><?php single_cat_title('Category: '); ?></h1>
</div>
<!-- /.header-caption -->
</div>
<!-- /.col-md-12 -->
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</header>

<div id="blogs">
<div class="blog-items section-area">
<div class="container">
<div class="row">
<div class="col-md-12">

<?php


while(have_posts()): the_post(); ?>

<div class="blog-item">
<div class="row">
<div class="col-md-5">
<div class="blog-photo">
<a href="<?php echo get_permalink(); ?>">
<?php
$values = get_field( 'featured_image_blog' );
if ( $values ) { ?>
<?php
$imageID = get_field('featured_image_blog');
$image = wp_get_attachment_image_src( $imageID, 'blogthumb-image' );
$alt_text = get_post_meta($imageID , '_wp_attachment_image_alt', true);
?>

<img class="img-responsive" alt="<?php echo $alt_text; ?>" src="<?php echo $image[0]; ?>" />
<?php
} else { ?>
<img src="<?php bloginfo('template_directory'); ?>/img/misc/placeholder.jpg" alt="">
<?php } ?>

<i class="fal fa-image"></i>
</a>
</div>
<!-- /.blog-photo-->
</div>
<!-- /.col-md-5 -->
<div class="col-md-7">
<div class="blog-content">
<div class="blog-meta">
<?php $author_id = get_the_author_meta( 'ID' ); ?>
<span><a href="<?php echo get_author_posts_url($author_id); ?>"><?php the_author_meta( 'display_name', $author_id ); ?> </a></span>

<span>
<?php
global $post;
$categories = get_the_category($post->ID);
$cat_link = get_category_link($categories[0]->cat_ID);
echo '<a href="'.$cat_link.'">'.$categories[0]->cat_name.'</a>'
?>
</span>
<span><a href="javascript:;"><?php echo get_the_date( 'F j, Y' ); ?></a></span>
</div>
<!-- /.category -->
<h2><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_field('excerpt_text'); ?>
<a href="<?php echo get_permalink(); ?>" class="read-more">Read More</a>
</div>
<!-- /.blog-content -->
</div>
<!-- /.col-md-7 -->
</div>
<!-- /.row -->
</div>

<?php endwhile; ?>

<nav class="pagination-block">
<?php if( function_exists('wp_pagenavi') ) wp_pagenavi(); // WP-PageNavi function ?>
</nav>

</div>
<!-- /.col-md-12 -->
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</div>
<!-- /.blog-items -->
</div>
<!-- /#blogs -->

<?php get_footer(); ?>
2 changes: 1 addition & 1 deletion css/theme.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/theme.min.css.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions sass/theme/pages/_blogs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
display: flex;
align-items: center;
justify-content: center;
height: 330px;
img {
height: 100%;
width: 100%;
object-fit: cover;
}
i {
opacity: 0;
@include animate-fade;
Expand All @@ -29,6 +35,7 @@
}
a {
display: block;
height: 100%;
&:after {
position: absolute;
width: 100%;
Expand Down

0 comments on commit 1bb77d4

Please sign in to comment.