mgsisk / webcomic

Comic publishing power for the web. Turn your WordPress-powered site into a comic publishing platform with Webcomic.
http://wordpress.org/plugins/webcomic
GNU General Public License v2.0
110 stars 29 forks source link

archive page sort by date #267

Closed lop03 closed 6 years ago

lop03 commented 8 years ago

Hi all!

I try to make an archive page to list all my comics, for tha i use the Webcomic archive template, but i'd like to sort them by date and i don't know how to do that..

please help !!

thanks,

luco

ykyu commented 8 years ago

The comics are in the archive are sorted by date by default?

lop03 commented 8 years ago

Hi Ykyu,

Thanks for your answer, that's right but i need to be more specific.

By default comics are sorted by date, and i don't want to change this, but i'd like that date of publication are printed to organize them in subcolumn.

to be more specific actually i'have this : http://www.lucoplesse.com/pticrouton/liens/

and i'd like a presentation like this: http://www.bouletcorp.com/ (go to see in archive menu)

Mihari commented 8 years ago
<?php
/** Collection-specific Webcomic archive.
 * 
 * @package Inkblot
 * @see github.com/mgsisk/webcomic/wiki/Templates
 */

/** Reverse the order of Webcomic archive pages and eliminate pagination. */
global $wp_query;

query_posts( array_merge( $wp_query->query_vars, array( 'nopaging' => true, 'posts_per_page' => -1, 'order' => 'DESC'  ) ) );

get_header(); ?>

<main id="main" role="main">
    <div id="webcomic-header" role="complementary" class="widgets"><?php dynamic_sidebar( 'webcomic-header' ); ?></div><!-- #webcomic-header -->
    <div id="post_content" class="page-content">
    <?php if ( have_posts() ) : ?>
        <header class="archive-header">
            <h1>Archive</h1>
        </header><!-- .archive-header -->
        <?php $month = ''; while ( have_posts() ) : the_post(); ?>
            <?php
                if ( $month !== get_the_time( 'M Y') ) {
                    $month = get_the_time( 'M Y' );

                    echo "<h3 class='archive-month'>{$month}</h3>";
                }
            ?>
            <article  id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
              <header class="post-header">
                  <span class="archive-link"><?php the_date('d:'); ?>&nbsp;<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'inkblot' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></span>
              </header><!-- .post-header -->
            </article>
        <?php endwhile; ?>
    <?php else : ?>
        <?php get_template_part( 'content-none', 'archive' ); ?>
    <?php endif; ?>
    </div>
    <br />
    <div id="webcomic-footer" role="complementary" class="widgets"><?php dynamic_sidebar( 'webcomic-footer' ); ?></div><!-- #webcomic-footer -->
</main><!-- #main -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Creating a collection.php file with these contents will generate the general look your looking for, you will have to use CSS to style it further.