Moin!
Ich bin gerade dabei ein Theme anzupassen, und hänge kurz vor dem Ende beim Custom Post Type Archiv fest. Denn ich will dass das Archiv (Ist ein Download - Archiv.) Alphabetisch sortiert ist - und nicht nach Datum des Posts.
Derzeitiger Code des Archiv Template file.
PHP
<?php get_header(); ?>
<div id="content-container">
<div id="col1" class="gk_downloads">
<?php if ( have_posts() ) : ?>
<?php $args = array( 'post_type' => 'gk_downloads' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class() ?>>
<div class="article-img"><?php the_post_thumbnail(array(75,75) ); ?></div>
<header class="entry-header">
<h1 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permalink zu <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</h1>
<div class="breaker"></div>
</header><!-- .entry-header -->
</article>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Alles anzeigen
Zwar findet man etwas über das Alphabetische sortieren im Codex, aber anscheinend funktioniert es nicht mehr.:?:
PHP
<?php get_header(); ?>
<div id="content-container">
<div id="col1" class="gk_downloads">
<?php $posts = query_posts($query_string . '&orderby=title&order=asc&posts_per_page=-1'); if ( have_posts() ) : ?>
<?php $args = array( 'post_type' => 'gk_downloads' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class() ?>>
<div class="article-img"><?php the_post_thumbnail(array(75,75) ); ?></div>
<header class="entry-header">
<h1 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permalink zu <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</h1>
<div class="breaker"></div>
</header><!-- .entry-header -->
</article>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Alles anzeigen
Oder habe ich das wichtige ''$posts = query_posts($query_string . '&orderby=title&order=asc&posts_per_page=-1');'' nur falsch positioniert?