0

I'll try to be as clear as possible.

I'm working on a project that requires posts organised by category and date. I need something like this:

First step: Annual listing of archive

2014: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 2013 2012 2011 2010...

Second step: by clicking on a year link, you are directed to another page where the category and subcategories for the related month are listed.

Music (January 2014) Rock “The History of AC/DC” Hip Hop “What Ever Happened to Bell Biv Devoe?” Pop Bruce Springsteen – High Hopes Pharrell Williams
Other David Bowie's The Next Day U2

The subcategories can be use each month or new one can be created and used only once. The main category (Music) will have no post.

I can have (second step) post from categories and subcategories work using the code on this page http://www.cssreflex.com/snippets/list-wordpress-posts-category/ But it's not limited to a specific month or year.

Thank you for helping me or ponting me to the right direction to solve my issue.

1
  • 1
    What has been your research so far? Sharing your research helps everyone. Tell us what you found and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and above all, it helps you get a more specific and relevant answer. Also please show us your code. More info about how to ask a good question can be found on the How to Ask page.
    – kaiser
    Jan 16, 2014 at 22:19

1 Answer 1

0

Looking for the solution, I want to give more information about what I have done so far:

My Actual configuration - WordPress : 3.8 - PHP : 5.3 - Theme : custom based on _s (underscore) - Hebergeur : local XAMPP

My archive template

        <main id="main" class="site-main" role="main">

        <?php
        // get all the categories from the database
        $cats = get_categories('child_of=34'); //cat 34 is the main category

            // loop through the categries
            foreach ($cats as $cat) {
                // setup the cateogory ID
                $cat_id= $cat->term_id;
                // Make a header for the cateogry
                echo "<h2>".$cat->name."</h2>";
                // create a custom wordpress query
                query_posts("cat=$cat_id&posts_per_page=-1");
                // start the wordpress loop!
                if (have_posts()) : while (have_posts()) : the_post(); ?>

                    <?php // create our link now that the post is setup ?>
                    <a href="<?php the_permalink();?>"><?php the_title(); ?></a>
                    <?php echo '<hr/>'; ?>

                <?php endwhile; endif; // our wp loop will start again for each category ?>
            <?php } // done the foreach statement ?>

    </main><!-- #main -->

1- try using wp_get_archives, I got months listing but it's impossible to exclude/include specific category.

2- try using wp_list_categories, I got categories listing but it's impossible to exclude/include specific category.

I found "WordPress Category Archive" plugin but he hasn't been updated since 2011 I also found http://kwebble.com "WordPress plugin Archives for a category" but it's no longer maintained.

Still looking to find the solution.

Thanks for your help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.