Multi-Column Custom Post Type Archive Page
-
I have created an archive page for a custom post type called “Courses.” I want to have all the courses show up alphabetically under an h2 tag with the letter the courses begin with. For instance Math would show up under and h2 tag “M.” It needs to be multi column based on how many courses have the particular letter. So if there are 50 courses that start with “B,” it would need several columns so that it is not a long page. Here’s the code I Have.
<?php /** * Template Name: Courses * * Selectable from a dropdown menu on the edit page screen. */ ?> <?php get_header(); ?> <div id="content-container"> <div id="content" class="clearfix"> <div id="main-content" style="width:100%"<?php if (get_option('sf_sidebar') =='right'): echo "class=\"alignright\""; endif; ?>> <?php get_template_part('breadcrumbs');?> <?php // the query $args=array( 'post_type' => 'courses', 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts'=> 1, 'orderby' => 'title', 'order' => 'ASC',) ?> <?php $the_query = new WP_Query( $args ); ?> <?php if ( $the_query->have_posts() ) : ?> <!-- pagination here --> <!-- the loop --> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <p id="courses-listing"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php endwhile; ?> <!-- end of the loop --> <!-- pagination here --> <?php wp_reset_postdata(); ?> <?php else : ?> <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p> <?php endif; ?> <?php get_footer(); ?>Thanks in advance!!!!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Multi-Column Custom Post Type Archive Page’ is closed to new replies.