File: /var/www/iprojectlab.com/laracopilot-wp/wp-content/themes/laracopilot/archive.php
<?php
/**
* The template for displaying archive pages
*
* @package LaraCopilot
* @version 1.0.0
*/
get_header(); ?>
<div class="min-h-screen pt-20">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<!-- Archive Header -->
<header class="text-center mb-16">
<h1 class="text-4xl sm:text-5xl font-bold text-white mb-6">
<?php
if (is_category()) {
single_cat_title();
} elseif (is_tag()) {
single_tag_title();
} elseif (is_author()) {
the_author();
} elseif (is_date()) {
if (is_year()) {
echo get_the_date('Y');
} elseif (is_month()) {
echo get_the_date('F Y');
} elseif (is_day()) {
echo get_the_date();
}
} else {
post_type_archive_title();
}
?>
</h1>
<?php if (category_description() || tag_description()) : ?>
<div class="text-xl text-gray-300 max-w-3xl mx-auto">
<?php echo category_description() . tag_description(); ?>
</div>
<?php endif; ?>
</header>
<!-- Posts Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('group bg-black/40 backdrop-blur-sm border border-red-500/20 rounded-2xl overflow-hidden hover:border-red-500/40 transition-all duration-300 hover:transform hover:scale-105'); ?>>
<?php if (has_post_thumbnail()) : ?>
<div class="aspect-video overflow-hidden">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('laracopilot-feature', array('class' => 'w-full h-full object-cover group-hover:scale-110 transition-transform duration-300')); ?>
</a>
</div>
<?php else : ?>
<div class="aspect-video bg-gradient-to-br from-red-500/20 to-red-700/20 flex items-center justify-center">
<a href="<?php the_permalink(); ?>" class="text-center">
<svg class="w-12 h-12 text-red-400 mx-auto mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"></path>
</svg>
<span class="text-red-400 text-sm">Read More</span>
</a>
</div>
<?php endif; ?>
<div class="p-6">
<div class="flex items-center text-sm text-gray-400 mb-3">
<time datetime="<?php echo get_the_date('c'); ?>"><?php echo get_the_date(); ?></time>
<span class="mx-2">•</span>
<span><?php the_author(); ?></span>
</div>
<h2 class="text-xl font-semibold text-white mb-3 group-hover:text-red-400 transition-colors duration-300">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h2>
<p class="text-gray-300 leading-relaxed mb-4">
<?php echo wp_trim_words(get_the_excerpt(), 15, '...'); ?>
</p>
<a href="<?php the_permalink(); ?>" class="inline-flex items-center text-red-400 hover:text-red-300 transition-colors duration-300">
Read More
<svg class="ml-2 w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path>
</svg>
</a>
</div>
</article>
<?php endwhile; ?>
<?php else : ?>
<div class="col-span-full text-center py-12">
<svg class="w-16 h-16 text-gray-400 mx-auto mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 0112 15c-2.34 0-4.29-1.009-5.824-2.709M15 6.291A7.962 7.962 0 0012 5c-2.34 0-4.29 1.009-5.824 2.709"></path>
</svg>
<h3 class="text-xl font-semibold text-white mb-2">No posts found</h3>
<p class="text-gray-400">Sorry, no posts were found in this archive.</p>
</div>
<?php endif; ?>
</div>
<!-- Pagination -->
<?php if (have_posts()) : ?>
<div class="mt-12 flex justify-center">
<?php
the_posts_pagination(array(
'mid_size' => 2,
'prev_text' => '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg> Previous',
'next_text' => 'Next <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg>',
'class' => 'pagination',
));
?>
</div>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>