• Resolved darksigns

    (@darksigns)


    Hi all,

    I wrote a simple code to list events in 2 column grid but I miss something, there is nothing placed in my second column just in the first.
    here is my content-grid template code:

    <?php
    $args = array(	'post_type' => 'event',
    				'posts_per_page' => 10,
    				'meta_query' => array(
    					array( 'key' => '_start_ts', 'value' => current_time('timestamp'), 'compare' => '>=', 'type'=>'numeric' )),
    				'orderby' => 'event_start_date',
    				'order' => 'DESC'
     				 );
    $loop = new WP_Query( $args );
    $num_cols = 2; // set the number of columns here
    for ( $i=1 ; $i <= $num_cols; $i++ ) :
    echo '<div id="col-' . $i . '" class="col" >';
    $counter = $num_cols + 1 - $i;
    	while ( $loop->have_posts() ) : $loop->the_post();
    		if( $counter%$num_cols == 0 ) :
    		// begin of core posts output ?>
    		<strong><?php echo EM_Events::output( $args );?></strong>
           		<?php endif; $counter++; endwhile;?>
    		<?php rewind_posts();
    echo'</div>'; endfor; ?>
        <?php if (  $wp_query->max_num_pages > 1 ) : ?>
    	<div id="nav-below" class="navigation">
    		<?php if(function_exists('page_navi')) { page_navi(); } else { ?>
    		<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
    		<?php } ?>
            </div><!-- #nav-below -->
    	<?php endif;?>
    <?php wp_reset_query(); ?>

    any ideas?

    thank you

    http://wordpress.org/extend/plugins/events-manager/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter darksigns

    (@darksigns)

    An update: sorry but I wrote wrong both columns has the same content !

    Thread Starter darksigns

    (@darksigns)

    Update:

    I made my code as simple as I could, to find out the error,
    when using this as my page 1 have 1 event saved on my site and this silly code prints that event 2 times in each column.

    <?php
    global $post ;
    $args = array('post_type' => 'event');
    $loop = get_posts( $args );
    $num_cols = 2; // set the number of columns here
    for ( $i=1 ; $i <= $num_cols; $i++ ) :
    echo '<div id="col-' . $i . '" class="col" >';
    $counter = $num_cols + 1 - $i;
    foreach ( $loop as $post):
    		if( $counter%$num_cols == 0 ) :
    		// begin of core posts output
    			em_events( $args );
    		endif; $counter++;
    endforeach;
    echo'</div>'; endfor;
    ?>

    please somebody help meeee..

    I may be missing something but since you’ve set $num_cols = 2, you’re forcing the code to run twice.

    Thread Starter darksigns

    (@darksigns)

    hm,

    if I put inside the the_content() it runs well and shows the correct things but everything with the maps and so on
    but when i use it with the include’events-lsit.php it runs 3 times:)
    ok than how can I do it?

    I am lost
    THX

    Plugin Support angelo_nwl

    (@angelo_nwl)

    hi,

    don’t know if this will help you since I haven’t tried this but I think you can create something similar with this http://stackoverflow.com/questions/15457089/creating-a-grid-view-of-products-in-php

    Thread Starter darksigns

    (@darksigns)

    thanx in the meantime I solved it with css !

    Please help me I’ trying to create a page that can be accessible via main menu and that displays all scheduled events in either a calendar or ideally in a categorized list ( by type and date…

    NOT in the widget area!

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    @pierrem7 pls open a new thread

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘how to list events in a grid’ is closed to new replies.