WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How can I get daily archives? (7 posts)

  1. DickMo777
    Member
    Posted 8 years ago #

    The default WordPress 1.5 theme evidently offers a daily archive option, but I don't know how to select it. The archive.php theme includes the code:

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

    but how can I make "is_day()" true? And where would I find it?

    My blog url is moralorigins.com and I will be posting a long essay once a week (about 2000 words each), so I want only the latest post on the "Home" page and only one post on each archive page. The archive listing should reference each post individually, showing its date and title, and the listing should be located on a separate "Archive List" page, rather than in a sidebar. Can I do that in the default theme? I have an elemetary knowledge of HTML.

    Thanks,
    Dick (a blog newbie who's trying to learn fast)
    Thanks

  2. Kafkaesqui

    Posted 8 years ago #

    http://codex.wordpress.org/Template_Tags/wp_get_archives

    See the information at the link above on the 'type' parameter, which along with the monthly option allows you to output archive links as daily, weekly and postbypost.

    If you want this output to an "Archive List" page, you could set up a Page (i.e. Write > Write Page) for this, and then create a simple custom Page template that calls wp_get_archives() to display your archives. See here for more on setting up a custom Page template:

    http://codex.wordpress.org/Pages#Creating_your_own_Page_Templates

  3. DickMo777
    Member
    Posted 8 years ago #

    Thanks, Kafkaesqui. But I'm still not there.

    As you suggested, I have uploaded a modification to the original archives.php template, called archives_list.php, which replaces type=monthly with type=postbypost in the wp_get_archives statement, by following instructions in the Codex document Creating_Your_Own_Page_Template. I also created a new page, Archive Index, by following instructions in the Codex document Creating_an_Archive_Index. (Those instructions were for WP1.5, and maybe that's a problem, but I'm using the default 1.5 theme, if that matters.) But the resulting Archive Index page shows nothing except the title of the page. Of course, I don't yet have any archives, because I've just posted one post so far. I'm considering adding a couple of temporary short test posts to test it out.

    I still haven't figured out how to avoid having more than a single post on the home page as well as on each archive page. That's important since each weekly essay will be about 2000 words, and putting several on a page would make the page very long. Presumably, I need to modify the parameters of a get_post or wp-get-post statement, but I can't find one on any template or on the Index page. Where would it be? Or is my presumption wrong as to the approach?

    Again, the URL is moralorigins.com. This is my first blog, and any help would be welcome.

    Dick

  4. moshu
    Member
    Posted 8 years ago #

    For the one post on page > admin > Options > Reading and set the number of posts shown.

  5. DickMo777
    Member
    Posted 8 years ago #

    Thanks, moshu. I'm embarrassed that I spent hours trying to solve that problem and somehow missed such an easy solution. I assume I have now ensured only one post on the home page, but still need to do the same on archive pages. Specifying wp_get_archives('type=postbypost') on my new template for the achive index page only affects the index list, I assume, and doesn't ensure that each archived post will be printed on a separate page. I still haven't figured that one out.

    Dick

  6. moshu
    Member
    Posted 8 years ago #

    You are over-complicating it :)
    That setting (=1 post) applies to ALL your views: [in WP lingo] monthly or category archives, search, main page... everything.

  7. DickMo777
    Member
    Posted 8 years ago #

    Yep, Moshu, I was over-complicating it. Since I have only one post so far and no archives, I tested with a couple of temporary short posts, and found that, sure enough, each is always on a separate page.

    The reason my Archive Index page didn't work was that I had followed the procedure for WP 1.5 for assigning a template. I used the procedure for WP 1.5+ and -- magic! -- it works.

    Now I'm working on displaying the date as well as the title on the archive list, but I should be able to figure that out myself.

    Thanks again. Resolved.

    Dick

Topic Closed

This topic has been closed to new replies.

About this Topic