Forums

Help Removing Category Archive Label/Spacing (8 posts)

  1. KMLProxy
    Member
    Posted 1 year ago #

    Hello,

    I don't like that when I click on a category link, and it shows me all articles categorized as X, that at the top it says, "Archive for X category", etc. I went into my archive.php and found:

    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2 class="pagetitle"><?php printf(__('Archive for the ‘%s’ Category', 'kubrick'), single_cat_title('', false)); ?></h2>
    <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
    <h2 class="pagetitle"><?php printf(__('Posts Tagged ‘%s’', 'kubrick'), single_tag_title('', false) ); ?></h2>
    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class="pagetitle"><?php printf(_c('Archive for %s|Daily archive page', 'kubrick'), get_the_time(__('F jS, Y', 'kubrick'))); ?></h2>
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="pagetitle"><?php printf(_c('Archive for %s|Monthly archive page', 'kubrick'), get_the_time(__('F, Y', 'kubrick'))); ?></h2>
    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2 class="pagetitle"><?php printf(_c('Archive for %s|Yearly archive page', 'kubrick'), get_the_time(__('Y', 'kubrick'))); ?></h2>
    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <h2 class="pagetitle"><?php _e('Author Archive', 'kubrick'); ?></h2>
    <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
    <h2 class="pagetitle"><?php _e('Blog Archives', 'kubrick'); ?></h2>
    <?php } ?>

    This block of code. Removing the "<h2 class="pagetitle"><?php printf(__('Archive for the ‘%s’ Category', 'kubrick'), single_cat_title('', false)); ?></h2>" line removes the text but, when you look at the category page there is still a block of color at the top where the text used to occupy. How can I remove that little block so that the top thing is the first article? Any ideas?

    You can see the strip I'm talking about here:
    http://www.thepoliticalpodium.com/category/government/the-congress/

    Thanks,
    KMLProxy

  2. vtxyzzy
    Member
    Posted 1 year ago #

    The strip is a block styled for a post, but empty. Is it possible that the code following the block you posted is adding an empty post to the loop?

    Can you put the header back in and let us see the results with the header?

  3. KMLProxy
    Member
    Posted 1 year ago #

    I've restored the code I deleted, and the full item I want removed is visible.

    I want that entire block removed.

    http://www.thepoliticalpodium.com/category/government/the-congress/

  4. vtxyzzy
    Member
    Posted 1 year ago #

    OK, the header is in a div with class="art-post", but so is the other post on the page. There must be code before and after the segment you posted that sets the class to art-post. You will need to remove that code also.

  5. KMLProxy
    Member
    Posted 1 year ago #

    Hmm... here is the entirety of the archive.php from the top down a ways past the code I've displayed already. Can you isolate and recommend what needs to be removed?

    <?php get_header(); ?>
    <div class="art-content-layout">
    <div class="art-content-layout-row">
    <?php include (TEMPLATEPATH . '/sidebar1.php'); ?><div class="art-layout-cell art-content">

    <?php is_tag(); ?>
    <?php if (have_posts()) : ?>

    <div class="art-post">
    <div class="art-post-tl"></div>
    <div class="art-post-tr"></div>
    <div class="art-post-bl"></div>
    <div class="art-post-br"></div>
    <div class="art-post-tc"></div>
    <div class="art-post-bc"></div>
    <div class="art-post-cl"></div>
    <div class="art-post-cr"></div>
    <div class="art-post-cc"></div>
    <div class="art-post-body">
    <div class="art-post-inner art-article">

    <div class="art-postcontent">
    <!-- article-content -->

    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2 class="pagetitle"><?php printf(__('Archive for the ‘%s’ Category', 'kubrick'), single_cat_title('', false)); ?></h2>
    <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
    <h2 class="pagetitle"><?php printf(__('Posts Tagged ‘%s’', 'kubrick'), single_tag_title('', false) ); ?></h2>
    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class="pagetitle"><?php printf(_c('Archive for %s|Daily archive page', 'kubrick'), get_the_time(__('F jS, Y', 'kubrick'))); ?></h2>
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="pagetitle"><?php printf(_c('Archive for %s|Monthly archive page', 'kubrick'), get_the_time(__('F, Y', 'kubrick'))); ?></h2>
    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2 class="pagetitle"><?php printf(_c('Archive for %s|Yearly archive page', 'kubrick'), get_the_time(__('Y', 'kubrick'))); ?></h2>
    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <h2 class="pagetitle"><?php _e('Author Archive', 'kubrick'); ?></h2>
    <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
    <h2 class="pagetitle"><?php _e('Blog Archives', 'kubrick'); ?></h2>
    <?php } ?>

    <?php
    $prev_link = get_previous_posts_link(__('Newer Entries »', 'kubrick'));
    $next_link = get_next_posts_link(__('« Older Entries', 'kubrick'));
    ?>

    <?php if ($prev_link || $next_link): ?>
    <div class="navigation">
    <div class="alignleft"><?php echo $next_link; ?></div>
    <div class="alignright"><?php echo $prev_link; ?></div>
    </div>
    <?php endif; ?>

  6. vtxyzzy
    Member
    Posted 1 year ago #

    The problem is that the navigation links are also included in that div. When you have more posts than will show on one screen, the navigation appears in that div. You can't remove the div without messing up the navigation. It is not just a matter of removing some code. I think you are stuck with the 'Archive for ...' text without a major rewrite of the code.

  7. wpvince
    Member
    Posted 1 year ago #

    I edited this:
    <h2 class="pagetitle">Archive for the ‘<?php single_cat_title(); ?>’ Category</h2>

    To this:
    <h2 class="pagetitle"><?php single_cat_title(); ?></h2>

    Now it only displays the heading title of the catagory name, which is fine for me.
    Hope that helps others.

  8. vtxyzzy
    Member
    Posted 1 year ago #

    If the problem is solved, please use the dropdown at top right to mark this topic 'Resolved' so that others researching this problem can see that there is a solution.

Topic Closed

This topic has been closed to new replies.

About this Topic