WordPress.org

Ready to get started?Download WordPress

Forums

Making calendar structure for posts/events (2 posts)

  1. Arsene
    Member
    Posted 4 years ago #

    Hello,

    I spent with this issue an entire week before I came to conclusion that yes, it is time for my first WordPress threat.

    Here is my web: http://www.pilot-prague.cz/?cat=3 As you can see, it is web of music club with regular events.

    There is no problem with posts about future events. I simply use this code:

    <?php
    	$wp_query = new WP_Query();
    	$wp_query->query('category_name=events-2&post_status=future&showposts=3&order=ASC'.'&paged='.$paged);
    	$do_not_duplicate = $post->ID;
    ?>
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    <!--Do stuff-->
    
    <?php endwhile; ?>
    
    <?php next_posts_link('<div class="nav_next2"></div>'); ?>
    <?php previous_posts_link('<div class="nav_prev2"></div>'); ?>

    For past events, the code is even more obvious.

    <?php
    	$wp_query = new WP_Query();
    	$wp_query->query('category_name=events-2&showposts=3&'.'&paged='.$paged);
    	$do_not_duplicate = $post->ID;
    ?>
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    <!--Do stuff-->
    
    <?php endwhile; ?>
    <?php next_posts_link('<div class="nav_next2"></div>'); ?>
    <?php previous_posts_link('<div class="nav_prev2"></div>'); ?>

    And here is the pain in my ass: The index page should provide navigation links. This means that from the page with 1st-3rd future post you should be able to jump to 4th-6th future post and more (next posts link - no problem) and back to 1st-3rd past post and more (previous posts link - damn!). It is much more complicated than it sounds actually. :)

    I tried about five slightly bizarre sollutions (even hiding links with z-indexes depending on the page by conditional tags to be honest :D) and none of them work.

    But yes, I'm opened to any other ideas how to archive the post events as well as display future ones. I found bunch of plugins and other hacking sollutions that just took care of future. None which would be able to deal with the past (and archive it somehow).

    Thanks and sorry for my fluster. Arsene

  2. Arsene
    Member
    Posted 4 years ago #

    Anyone, please? Or was it too much of desperate fluster?

Topic Closed

This topic has been closed to new replies.

About this Topic