ThemeShaper Forums » Thematic

[closed]

Customizing archives

(7 posts)
  • Started 7 years ago by him
  • Latest reply from him
  • This topic is not resolved
  1. him
    Member

    I have been reading all over for customizing archives, and it's getting more and more confusing. I want to customize the Archives on a site. So far, I have been able to make a custom Archives Index listing posts by Category, Year and Month (using archives.php).

    What I'm unable to do is to change the Monthly archives, Alphabetical archives, Archives by author and so on. For instance, Monthly Archives shows a list of all the posts with excerpts. What I want is to show just the titles of the post and change the layout (that I think I can do with css, once I find out which template to target).

    Posted 7 years ago #
  2. him
    Member

    For Starters, I'm displaying the Current Month posts of a particular Category in Grid on the front page.

    ' <div class="g">

    <?php
    global $cat;
    $recentPosts = new WP_Query();
    $recentPosts->query("monthnum=$current_month&cat=1&order=ASC");
    ?>
    <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
    <li class="g-fp"><span class="date"><?php the_time('j') ?></span><span class="post-title">" rel="bookmark"><?php the_title(); ?></span>
    <?php endwhile; ?>

    </div><!-- .g --> '

    Now, I want to have the same Grid display for each month's archives for that category. My css styling is all set. I guess I have to somehow include/change the class for monthly archives posts, but how??

    Posted 7 years ago #
  3. middlesister
    Member

    The monthly archives are controlled by the archive loop. You can change how they are displayed using a childtheme_override_archive_loop function in your child theme's functions.php. Since the same loop is also used for the other archives you need a conditional to target only the monthly.

    example:

    function childtheme_override_archive_loop() {
        if( is_monthly ) {
            // your monthly archive loop
        } else {
            // your other archive loop
        }
    }
    Posted 7 years ago #
  4. him
    Member

    Thanks Middlesister but I'm way too noob to put this code in order. i tried adding my custom loop (picking from what I did in the front page but I guess i am missing pieces. here is what i picked up from the content-extensions archive loop:

    function childtheme_override_archive_loop() {
        if( is_monthly && is_category ('1')) {
         					<div class="g">
    						<li id="monthly-archives" class="content-column">
    							<h2><?php _e('Archives by Month', 'thematic') ?></h2>
    							<ul>
    								<li class="g-fp"><span class="date"><?php the_time('j') ?></span><span class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></span></li>
    							</ul>
    						</li>
    						</div>
    		<?php }
        } else {
            function thematic_monthly_archives() { ?>
    						<li id="monthly-archives" class="content-column">
    							<h2><?php _e('Archives by Month', 'thematic') ?></h2>
    							<ul>
    								<?php wp_get_archives('type=monthly&show_post_count=1') ?>
    							</ul>
    						</li>
    		<?php }
        }
    }
    Posted 7 years ago #
  5. him
    Member

    All i want to do is basically to display ANY month's posts from Category - G in a grid form by adding a div class and li class, which I can target by css. So I guess if i can just wrap that monthly code in a div and add a li class to it, I should be able to get my display.

    Posted 7 years ago #
  6. i hope you aren't too noob to copy and paste? b/c really

    function childtheme_override_archive_loop() {
        if( is_monthly() ) {
            // copy in the code from thematic_archive_loop() and edit as you will
        } else {
            thematic_archive_loop();
        }
    }

    i'm not actually sure about monthly archives for a specific category. i don't think that is built in to WP by default. you'll probably need a special plugin

    Posted 7 years ago #
  7. him
    Member

    Thanks for pointing that out Helga. I actually in error thought I need to copy and edit just the monthly archives code ( as that is my need). Would just go back to the board and try the whole archive code. The category specification still stands and I've been exploring how to fit that. Thanks again!

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.