Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm doing a corporate site migration into Wordpress, and need an extremely custom archive page for a custom post type. I know all about the archive-{post type}.php thing, but it needs to be more custom than that.

The page should have a little intro content (subtitle, 1-2 paragraphs) above a listing of the events post-type.

In keeping in spirit with using a CMS, it's my goal to not hard code the content so it can easily be changed, and also to make it fairly simple for the end users. My best idea right now is a page template with a query hard coded in to display the other posts, something like:

<?php
/*
 Template Name: Events Page
 */

while (have_posts()) : the post ();
    the_title();
    the_field('subtitle');  // Advanced Custom Fields function

    the_content();

    $events_list = new WP_Query(array(
        'post_type' => 'events',
        'meta_key' => 'start_date',
        'meta_value' => date('Y-m-d'),
        'meta_compare' => '>=',
    ));
    while ($events_list->have_posts()) : $events_list->the_post();
        /*
         Custom post content here
         */
    endwhile;
    wp_reset_postdata();

endwhile;

While this would fulfill my basic need, the real goal is to have a paginated archive, and it doesn't seem that I can get that functionality doing this. Does anyone have any ideas for how to get a paginated archive with the ability to add content above the listings?

share|improve this question
    
You might want to look into adding Meta Boxes which is pretty powerful and can add tons of customization. This way you can add an extra Text Editor which sounds like what you're looking for. Finally for the pagination you could look into.. Well Pagination –  Howdy_McGee Nov 11 '13 at 22:35
    
I've accomplished something similar with advanced custom fields. Essentially you create option pages, then place the code in that template to test and display it. That's probably going to be your best implementation for it, however I do not believe that is included in the free version. –  Jonathan Nov 11 '13 at 22:49

1 Answer 1

up vote 0 down vote accepted

This post might help. Keep an eye out for the paginate_links(); function.

With the default paginate_links() setup, it will append the page number to the URL like so:

mypage.com/my-page/?page=5

So, on your page, you'd want to pass paged => $_GET['page'] along with your WP_Query args.

Create a new question if you're still struggling, and comment here with the link.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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