Support » Fixing WordPress » Remove Dates from Archived Posts

  • Resolved JG99

    (@jg99)


    Hello, I want to remove the dates from archived posts. Here is the archive.php file:

    <h2 class=”pagetitle”><?php printf(__(‘Archive for the ‘%1$s’ Category’), single_cat_title(”,false)); ?></h2>
    <?php endif; ?>

    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class=”pagetitle”><?php printf(__(‘Archive for %1$s’), get_the_time(__(‘F jS, Y’))); ?></h2>

    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class=”pagetitle”><?php printf(__(‘Archive for %1$s’), get_the_time(__(‘F, Y’))); ?></h2>

    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2 class=”pagetitle”><?php printf(__(‘Archive for %1$s’), get_the_time(‘Y’)); ?></h2>

    Do I remove code starting from [get_the_time] until the final [)]?

    Thank you for your help.

Viewing 13 replies - 1 through 13 (of 13 total)
  • That probably isn’t the right code you want to change if you are wishing to no longer display the date with each post.

    Look for something like ‘the_date’ or ‘the_time’.

    MichaelH, is the key in the [Hack. Set $post so that the_date() works.] section?

    I have been able already to turn off the date on current posts, I am concerned now with the archives.

    Thanks for your help, sorry to post so much code. How can I post code in a neater fashion?
    ——————————————————–

    <?php get_header(); ?>

    <div id=”content” class=”narrowcolumn”>

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

    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>

    <?php if (function_exists(‘lang_picker_respect_more’)) : ?>
    <h2 class=”pagetitle”><?php printf(__(‘Archive for the ‘%1$s’ Category’), lang_picker_respect_more(single_cat_title(”,false))); ?></h2>
    <?php else : ?>
    <h2 class=”pagetitle”><?php printf(__(‘Archive for the ‘%1$s’ Category’), single_cat_title(”,false)); ?></h2>
    <?php endif; ?>

    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class=”pagetitle”><?php printf(__(‘Archive for %1$s’), get_the_time(__(‘F jS, Y’))); ?></h2>

    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class=”pagetitle”><?php printf(__(‘Archive for %1$s’), get_the_time(__(‘F, Y’))); ?></h2>

    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2 class=”pagetitle”><?php printf(__(‘Archive for %1$s’), get_the_time(‘Y’)); ?></h2>

    <?php /* If this is a search */ } elseif (is_search()) { ?>
    <h2 class=”pagetitle”><?php _e(‘Search Results’); ?></h2>

    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <h2 class=”pagetitle”><?php _e(‘Author Archive’); ?></h2>

    <?php /* If this is a paged archive */ } elseif (isset($_GET[‘paged’]) && !empty($_GET[‘paged’])) { ?>
    <h2 class=”pagetitle”><?php _e(‘Blog Archives’); ?></h2>

    <?php } ?>

    Please provide a URL to show the problem and give an example of what you want removed.

    http://themes.jillij.com/category/themes/

    Michael, you can see where it says “Jillij version 14” and then below that it says “Sunday, July 6th, 2008”

    I want to remove “Sunday, July 6th, 2008”

    Thank you for helping me.

    Please paste all the code in that template into a pastebin such as wordpress.pastebin.com, and report the link back here.

    Are you saying I should paste the code for the entire theme? Or just for archive.php?

    Yes, just the archive.php if that is the template that is displaying the view you want to change. See Template Hierarchy to confirm.

    Delete this:

    <small><?php the_time(__('l, F jS, Y')) ?></small>

    Michael, it works! Thank you.

    Can I ask one more question?

    You will notice that this theme has a drop-down menu. I would like the menu to be at the top of the photo, rather than at the bottom. Can you help me change that?

    Better to start a new topic with that question.

    Here’s the header file link:

    http://wordpress.pastebin.com/NsiUqWg8

    And here’s the stylesheet file link:

    http://wordpress.pastebin.com/azh6nEap

    OK, will do.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Remove Dates from Archived Posts’ is closed to new replies.