WordPress.org

Ready to get started?Download WordPress

Forums

Add an introduction on every Category page (3 posts)

  1. hey2you
    Member
    Posted 6 years ago #

    Hello all,

    I want to write an introduction with some images for each Category page and locate it on top of all the related posts of that category. And the introduction are different for each Category page, therefore I think I cannot do it just by changing the template.

    What is the best way to do it or is there a plugin could do the job for me??

    Thanks!!

  2. beanfair
    Member
    Posted 6 years ago #

    I am thinking that it would depend on your theme. I am curious to see what other responses you get to this.

  3. mores
    Member
    Posted 6 years ago #

    The simplest solution would be to create a category.php file that displays the category's description at the top.

    <?php get_header(); ?>
    <!-- The Category's Description-->
    <h1><?php the_category(' ', 'parent'); ?></h1>
    <?php echo category_description(); ?>
    
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    	<p><?php the_excerpt('Read more >'); ?></p> <!-- or use the_content or leave away entirely --!>
    <?php endwhile; else: ?>Oops<?php endif; ?>
    
    <?php get_footer(); ?>

    Images are tough ... I think you'll have to use HTML then inside this category description.

    Alternatively create a page template. Use the page to display the category introduction, then do a listing of all posts of a certain category under that.
    Read up on page templates to see what they can do.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags