Initial Commit
This commit is contained in:
78
templates/blog-list.php
Normal file
78
templates/blog-list.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Template Name: blog page
|
||||
|
||||
*/
|
||||
get_header(); ?>
|
||||
<section class="section-top">
|
||||
<div class="container">
|
||||
<div class="col-lg-10 offset-lg-1 text-center">
|
||||
<div class="section-top-title">
|
||||
<h1>Blogs</h1>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li class="ms-1"> / Blogs</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<!-- blog and news part -->
|
||||
<section id="blog" class="blog_area section-padding overflow-hidden">
|
||||
<div class="container animated-box1" style="opacity: 1; transform: none; will-change: auto;">
|
||||
<!-- Section Title -->
|
||||
<div class="section-title text-center">
|
||||
<h2>Latest Blog & News</h2>
|
||||
<p>We offer a brand new approach to the most basic learning paradigms. Choose from a wide range of learning options and gain new skills! Our school is known.</p>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$args = array(
|
||||
'posts_per_page' => -1, // Fetch all posts
|
||||
|
||||
);
|
||||
$query = new WP_Query($args);
|
||||
?>
|
||||
<!-- Blog Entries -->
|
||||
<div class="row g-4">
|
||||
<?php
|
||||
if($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
|
||||
$categories = get_the_category();
|
||||
?>
|
||||
<!-- Blog 1 -->
|
||||
<div class="col-lg-4 col-sm-6 col-xs-12 mb-4 blog-card122">
|
||||
<div class="single_blog">
|
||||
<a href="<?php the_permalink(); ?>"><img src="<?= get_the_post_thumbnail_url(get_the_ID(), 'full'); ?>" class="img-fluid" alt="image">
|
||||
</a>
|
||||
<div class="content_box">
|
||||
<span>
|
||||
<div>
|
||||
<i class="fa-solid fa-calendar-days"></i> <?= the_date('M d, Y'); ?>
|
||||
</div>
|
||||
<?php
|
||||
// Display category names
|
||||
if (!empty($categories)) {
|
||||
foreach ($categories as $category) {
|
||||
echo '<a href="' . esc_url(get_category_link($category->term_id)) . '"> <i class="fas fa-th-list"></i> ' . esc_html($category->name) . '</a>';
|
||||
}
|
||||
} else {
|
||||
echo 'Uncategorized';
|
||||
}
|
||||
?>
|
||||
|
||||
</span>
|
||||
<h2><a href="<?php the_permalink(); ?>"><?= esc_html(mb_substr(get_the_title(), 0, 26)) . (strlen(get_the_title()) > 26 ? '...':'');?></a></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endwhile; wp_reset_postdata(); endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<nav class="mt-4">
|
||||
<ul class="pagination justify-content-center" id="pagination"></ul>
|
||||
</nav>
|
||||
<?php get_footer(); ?>
|
||||
Reference in New Issue
Block a user