Skip to content

Commit 89e6884

Browse files
committed
fixed categories loop page
1 parent 1d8c7e6 commit 89e6884

File tree

3 files changed

+337
-355
lines changed

3 files changed

+337
-355
lines changed

archive.php

Lines changed: 56 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,56 @@
1-
<?php
2-
/**
3-
* The template for displaying archive pages
4-
*
5-
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
6-
*
7-
* @package cjt
8-
*/
9-
10-
get_header();
11-
?>
12-
13-
<main id="primary" class="site-main">
14-
15-
<?php if ( have_posts() ) : ?>
16-
17-
<header class="page-header">
18-
<?php
19-
the_archive_title( '<h1 class="page-title">', '</h1>' );
20-
the_archive_description( '<div class="archive-description">', '</div>' );
21-
?>
22-
</header><!-- .page-header -->
23-
24-
<?php
25-
/* Start the Loop */
26-
while ( have_posts() ) :
27-
the_post();
28-
29-
/*
30-
* Include the Post-Type-specific template for the content.
31-
* If you want to override this in a child theme, then include a file
32-
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
33-
*/
34-
get_template_part( 'template-parts/content', get_post_type() );
35-
36-
endwhile;
37-
38-
the_posts_navigation();
39-
40-
else :
41-
42-
get_template_part( 'template-parts/content', 'none' );
43-
44-
endif;
45-
?>
46-
47-
</main><!-- #main -->
48-
49-
<?php
50-
get_sidebar();
51-
get_footer();
1+
<?php
2+
/**
3+
* The template for displaying archive pages
4+
*
5+
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
6+
*
7+
* @package cjt
8+
*/
9+
10+
get_header();
11+
?>
12+
13+
<main id="primary"class="bg-gray-100 min-h-screen py-8">
14+
<div class="container mx-auto px-4">
15+
<div class="flex flex-col lg:flex-row gap-x-4 md:gap-x-6">
16+
<div class="w-full">
17+
<?php if ( have_posts() ) : ?>
18+
19+
<header class="page-header mb-5 md:mb-10">
20+
<?php
21+
the_archive_title( '<h1 class="font-display text-3xl md:text-4xl font-semibold text-gray-800 mb-4">', '</h1>' );
22+
the_archive_description( '<div class="text-sm text-gray-600 flex items-center space-x-2">', '</div>' );
23+
?>
24+
</header><!-- .page-header -->
25+
26+
<?php
27+
/* Start the Loop */
28+
while ( have_posts() ) :
29+
the_post();
30+
31+
/*
32+
* Include the Post-Type-specific template for the content.
33+
* If you want to override this in a child theme, then include a file
34+
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
35+
*/
36+
get_template_part( 'template-parts/content', get_post_type() );
37+
38+
endwhile;
39+
40+
the_posts_navigation();
41+
42+
else :
43+
44+
get_template_part( 'template-parts/content', 'none' );
45+
46+
endif;
47+
?>
48+
</div>
49+
<?php get_sidebar(); ?>
50+
</div>
51+
52+
</div>
53+
</main>
54+
55+
<?php
56+
get_footer();

page.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
<?php
2-
/**
3-
* The template for displaying all pages
4-
*
5-
* This is the template that displays all pages by default.
6-
* Please note that this is the WordPress construct of pages
7-
* and that other 'pages' on your WordPress site may use a
8-
* different template.
9-
*
10-
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
11-
*
12-
* @package cjt
13-
*/
14-
15-
get_header();
16-
?>
17-
18-
<main id="primary" class="mx-auto max-w-7xl px-5 md:mt-20 mt-10">
19-
20-
<?php
21-
while (have_posts()) :
22-
the_post();
23-
24-
get_template_part('template-parts/content', 'page');
25-
26-
27-
// If comments are open or we have at least one comment, load up the comment template.
28-
if (comments_open() || get_comments_number()) :
29-
comments_template();
30-
endif;
31-
32-
endwhile; // End of the loop.
33-
?>
34-
35-
</main><!-- #main -->
36-
37-
<?php
38-
get_sidebar();
39-
get_footer();
1+
<?php
2+
/**
3+
* The template for displaying all pages
4+
*
5+
* This is the template that displays all pages by default.
6+
* Please note that this is the WordPress construct of pages
7+
* and that other 'pages' on your WordPress site may use a
8+
* different template.
9+
*
10+
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
11+
*
12+
* @package cjt
13+
*/
14+
15+
get_header();
16+
?>
17+
18+
<main id="primary" class="mx-auto max-w-7xl px-5 md:mt-20 mt-10">
19+
20+
<?php
21+
while (have_posts()) :
22+
the_post();
23+
24+
get_template_part('template-parts/content', 'page');
25+
26+
27+
// If comments are open or we have at least one comment, load up the comment template.
28+
if (comments_open() || get_comments_number()) :
29+
comments_template();
30+
endif;
31+
32+
endwhile; // End of the loop.
33+
?>
34+
35+
</main><!-- #main -->
36+
37+
<?php
38+
get_sidebar();
39+
get_footer();

0 commit comments

Comments
 (0)