dangermoose Posted June 8, 2010 Share Posted June 8, 2010 Hi all, Im new to php but enjoying the learning curve and also getting to know my way around WordPress. I am building a page to list events and came across a great tutorial http://www.problogdesign.com/wordpress/how-to-make-a-wordpress-events-list. I cannot manage to get it to work with my themes php though, it kind of works and does list the events but doesnt pull in the images assigned to each event (post). I also lost the 'next' and 'previous' buttons at the bottom of the page for some reason. I thoguth it had something to do with the <?php if (have_posts()) : while (have_posts()) : the_post(); ?> , maybe was in the wrong place but not so sure. Is there anything very obvious (Im sure there is!) I'm missing bearing in mind all I have added is the code from that url... <?php the_content(); ?> </div> </div> <?php //not sure about this? It was originally - while (have_posts()) : the_post(); if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="grid_4a alpha portfolio-box-events"> <div class="gallery clearfix" style="width:220px;"><br/> <?php $img=get_post_meta($post->ID, 'Image', true); $timthumboption = get_option("timthumboption"); ?> <?php if($img) { ?> <?php if( $timthumboption == "0" ){?> <a href="<?php echo $img; ?>" rel="prettyPhoto[gallery2]"> <img src="<?php bloginfo('template_url'); ?>/timthumb.php?src=<?php echo $img; ?> &w=204&h=104&zc=2" alt="<?php the_title(); ?>" class="thumbnail-border"/> </a> <?php } ?> <div style="position:relative; float:left; width:700px;"> <div style="width:204px; position:relative; float:left;"> <?php if( $timthumboption == "1" ){?> <a href="<?php echo $img; ?>" rel="prettyPhoto[gallery2]"><img src="<?php echo $img; ?>" width="204" alt="<?php the_title(); ?>" class="thumbnail-border"/></a> <?php } }?> </div> <?php // Get today's date in the right format $todaysDate = date('m/d/Y H:i:s');?> <?php query_posts('showposts=10&category_name=festival&meta_key=Date&meta_compare=>=&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC'); ?> <div style="width:450px; position:relative; float:left; margin-left:20px;"> <h3><a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a></h3> <p> <?php the_content(); ?> </p> <a href="<?php the_permalink() ?>" class="view-more2"><strong>View More</strong></a> <?php endwhile; else: ?> Sorry, no upcoming events! <?php endif; ?> <?php wp_reset_query(); ?> </div> </div> </div> </div> </div> <?php endwhile; ?> <div class="clear"> </div> <div class="navigation"> <div class="alignright"> <?php next_posts_link('Next Page »') ?> </div> <div class="alignleft"> <?php previous_posts_link('« Previous Page') ?> </div> </div> </div> <!--End Right Section --> </div> </div> </div> <!--End middle content Section --> <?php get_footer(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/204174-wp-events-list-ordering/ Share on other sites More sharing options...
dangermoose Posted June 9, 2010 Author Share Posted June 9, 2010 I've kind of got it working now. It display's the list in the correct order but the functionality of the 'next' and 'previous' buttons at the bottom of the page is broken, it basically loads the same posts again when clicking 'next'... This is the line of code that i edited: query_posts('cat=$portfoliopages.&paged=&showposts=20&category_name=festival&meta_key=Date&meta_compare=>=&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC'); I think there may be a conflict between 'cat=$portfoliopages' & the code I added in that line but not sure how to fix. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/204174-wp-events-list-ordering/#findComment-1069883 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.