category pages
This commit is contained in:
parent
6bac3c395b
commit
7e81f1a790
17
category.php
17
category.php
@ -6,7 +6,22 @@
|
||||
<?php get_template_part('global-head'); ?>
|
||||
<main id="main-content" class="container" role="main">
|
||||
|
||||
<h1><?php single_cat_title(); ?></h1>
|
||||
|
||||
<?php
|
||||
$cat = array_shift(get_the_category());
|
||||
|
||||
$query = new WP_Query( array(
|
||||
'name' => $cat->slug,
|
||||
'post_type' => 'page'
|
||||
));
|
||||
|
||||
$page = array_shift($query->get_posts());
|
||||
?>
|
||||
|
||||
<section>
|
||||
<h1><?php echo ($page->post_title) ? $page->post_title : $cat->name; ?></h1>
|
||||
<?php echo apply_filters('the_content', $page->post_content); ?>
|
||||
</section>
|
||||
|
||||
<div class="grid col-100">
|
||||
<?php get_template_part('loop'); ?>
|
||||
|
41
page.php
Normal file
41
page.php
Normal file
@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<?php get_header(); ?>
|
||||
<body>
|
||||
<a class="skip-nav sr-only" href="#main-content">Skip to main</a>
|
||||
<?php get_template_part('global-head'); ?>
|
||||
<main id="main-content" class="container" role="main">
|
||||
<section class="grid col-100 grid-gutter-lg">
|
||||
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
|
||||
<article class="post-article" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
|
||||
<?php if ( has_post_thumbnail()) : // Check if Thumbnail exists ?>
|
||||
<?php the_post_thumbnail(); // Fullsize image for the single post ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<h1><?php the_title(); ?></h1>
|
||||
|
||||
<?php the_content(); ?>
|
||||
|
||||
|
||||
<?php
|
||||
$cat = get_category_by_slug($post->post_name);
|
||||
$link = get_category_link($cat->term_id);
|
||||
|
||||
if($link) {
|
||||
echo "<p>See more from <a href=\"$link\">$cat->name</a></p>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php edit_post_link(); // Always handy to have Edit Post Links available ?>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php // get_sidebar(); ?>
|
||||
</section>
|
||||
</main>
|
||||
<?php get_footer(); ?>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user