WordPress.org

Forums

Only Monthly archives to show a list of posts (3 posts)

  1. bradyjfrey
    Member
    Posted 9 years ago #

    I'm hacking wordpress, and a wordpress theme, to be used as a method to publish security reports online for one of my clients. I've easily figured out how to make an archive page and customize it via some examples, but I have not figured out how to customize ALL the code based on resulting choice for that archive page -- most specifically the monthly links and limiting it to the current monthly choice:

    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="entrydate">Archive for <?php the_time('F, Y'); ?></h2>

      <?php wp_get_archives('type=daily'); ?>

    How do I limit that to only call the daily archives for that specific month? Thank you:)!!

  2. moshu
    Member
    Posted 9 years ago #

    How do I limit that to only call the daily archives for that specific month?

    Isn't that code doing exactly what you are asking for? = showing the daily archives of the month you clicked on.

  3. bradyjfrey
    Member
    Posted 9 years ago #

    No, it is listing all the dailies regardless of the current archive month. Here is the demo site, and here is my full code:

    <?php get_header(); ?>

    <div id="content">

    <?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()) { ?>
    <h2 class="entrydate">Archive for the '<?php echo single_cat_title(); ?>' Category</h2>

    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class="entrydate">Archive for <?php the_time('l, F jS, Y'); ?></h2>

    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="entrydate">Archive for <?php the_time('F, Y'); ?></h2>

      <?php wp_get_archives('type=daily'); ?>

    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2 class="entrydate">Archive for <?php the_time('Y'); ?></h2>

    <?php /* If this is a search */ } elseif (is_search()) { ?>
    <h2 class="entrydate">Search Results</h2>

    <?php } ?>

    <?php while (have_posts()) : the_post(); ?>
    <h3 class="entrytitle" id="post-<?php the_ID(); ?>"><cite><?php the_time('H:i') ?></cite> <!-- " rel="bookmark"> --><?php the_title(); ?> <?php the_author();?></cite></h3>

    <div class="entrybody">
    <?php the_content(__('(more...)')); ?>
    <?php edit_post_link('Edit'); ?>
    </div>

    <?php endwhile; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    <?php endif; ?>

    </div>
    <?php get_footer(); ?>

    I'd actually like to limit the loop to only show on daily page views, but I am ok having that load at the bottom as well, so long as the monthly results shows only that monthly page.

    Thank you for the help:)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.