WordPress.org

Support

Support » How-To and Troubleshooting » Add an introduction on every Category page

Add an introduction on every Category page

  • 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!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am thinking that it would depend on your theme. I am curious to see what other responses you get to this.

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add an introduction on every Category page’ is closed to new replies.