Support » Themes and Templates » Category view

Category view

  • Hi
    I run an educational site. I use two blog post categories for my posts, and have these categories in the menu, so it’s almost like there are two different blogs.

    Here’s one of the categories: http://www.mrlovegrove.net/category/children/

    How do I remove the ‘Archive for Children’ heading at the top of the categories page and the ‘Children’ label at the bottom. I want to do this for the teacher category also.

    Many thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • You will need to look at the template file that is used to output the WordPress loop. The name of this file and how it works will vary depending on the structure of your theme. For example, if I remember correctly, you would look in category.php in the twentyeleven theme, but in loop.php in the twentyten theme.

    The way I usually find the right file is to start at index.php and work my way back down the chain from there. A knowledge of the wordpress template hierarchy helps as well.

    Once you’ve found the template file you just need to get rid of the code that produces the output. It should be before the loop iterates.

    You might also want to bear in mind that the only recommended way of modifying a theme is via a child theme. So if you are not already using a child theme, you might want to consider using one.





    Forum Moderator

    edit archive.php of your theme;

    remove at least exactly:

    <h2 class="arh"><?php _e('Archive for', 'themezee_lang'); ?> <?php echo single_cat_title(); ?></h2>

    if you don’t want this header text in any other archives, remove the whole section from:
    <?php if (is_category()) { ?>
    to including:
    'Archives', 'themezee_lang'); ?></h2><?php } ?>

    for the line below the post, remove:

    <span class="folder"><?php the_category(', ') ?> </span>

    this will leave the grey strip below the post;
    if you are not planning to use tags, you could remove this whole section:

    <div class="postinfo">
    					<span class="folder"><?php the_category(', ') ?> </span>
    					<?php if (get_the_tags()) echo'<span class="tag">'; the_tags('', ', '); echo '</span>'; ?>

    You can do this using is_category

    Create a child theme, follow the peredur’s link.

    Copy archive.php from your parent theme to your child theme and change if (is_category()) on line 5 to if (is_category() && !is_category('children')). That will get rid of the Archive for thing.

    Next, scroll down until you see <div class="postinfo">. Change to the following:

    <?php if (!is_category('children')) : ?>
        <div class="postinfo">
            <span class="folder"><?php the_category(', ') ?> </span>
    	<?php if (get_the_tags()) echo'<span class="tag">'; the_tags('', ', '); echo '</span>'; ?>
    <?php endif; ?>

    That will get rid of the tags at the bottom.

    If you want this for all of your categories you should probably just follow alchymyth’s instructions.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Category view’ is closed to new replies.
Skip to toolbar