WordPress.org

Ready to get started?Download WordPress

Forums

Add Category Title Above Content On Each Page(s) (4 posts)

  1. laptopmemo
    Member
    Posted 4 years ago #

    What I'm trying to figure out to do is add the category title to each category page.

    Say you go to the "Leaks" category, right now you don't see the words "Leaks" above all of the posts in that category. I'd like to add that PHP string to my iBlog2 template so it can be easier for users to browse the site.

    my blog is LaptopMemo.com

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    this is a corresponding area from the default theme's archive.php:

    <?php /* If this is a category archive */ if (is_category()) { ?>
    		<h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>

    http://codex.wordpress.org/Template_Tags/single_cat_title
    <?php single_cat_title(); ?> will echo the category title.

    obviously, add this to category.php (or archive.php).

    btw: the default theme is always a useful source of inspiration, to find out 'how it is done'

  3. laptopmemo
    Member
    Posted 4 years ago #

    Thanks but I don't have a category.php file. From what I know of, copying the index.php file and calling it category.php is enough, right? And I do have an archive.php, but would thay show any changes in categories?

  4. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    this might answer yuor question:
    http://codex.wordpress.org/Template_Hierarchy

Topic Closed

This topic has been closed to new replies.

About this Topic