WordPress.org

Ready to get started?Download WordPress

Forums

Category view (4 posts)

  1. zazzle123
    Member
    Posted 2 years ago #

    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

  2. peredur
    Member
    Posted 2 years ago #

    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.

    HTH

    PAE

  3. alchymyth
    Forum Moderator
    Posted 2 years ago #

    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>'; ?>
    				</div>
  4. Andrei Olsen
    Member
    Posted 2 years ago #

    You can do this using is_category
    http://codex.wordpress.org/Function_Reference/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>'; ?>
        </div>
    <?php endif; ?>

    That will get rid of the tags at the bottom.

    [EDIT]:
    If you want this for all of your categories you should probably just follow alchymyth's instructions.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.