search-event-list.php
WordPress Event Management, Calendars & Registration › Forums › General Question › search-event-list.php
This topic contains 6 replies, has 2 voices, and was last updated by Chris Hirst 8 years ago.
-
AuthorPosts
-
January 5, 2017 at 7:42 pm #25607
I have been working on this all day, and thought I may as well ask the question now as I cannot work it out 🙁
All I want to do is display the results from the above search form in rows. Rows that I can put headings over like in a table. I just need the thumbnail, linked Image title, Date and Venue.
I am an absolute numpty at this. Could you wave your Harry Potter wand and magic a simple solution for me?
Thanks very much
ChrisChris HirstJanuary 6, 2017 at 2:43 pm #25614Hi Chris,
How comfortable are you with using PHP and HTML? The template file is in
event-organiser-pro/templates/search-event-list.php
and it’s just a matter of copying that file to your theme an editing it.The
while
loop contains the mark-up for each event. So you’ll want to contain it within a<table>
, and including<tr></tr>
with headers (you also make use of<tbody>
and<thead>
.Inside the
while
loop, you’d replace<article>...</article>
with<tr><td>..</td>...<td>..</td></tr>
, where<td>...</td>
contains the mark-up for that cell.Functions used for displaying event dates, title and thumbnail etc can be found in that template.
If you need further assistance with this, please just ask 🙂
Stephen HarrisJanuary 6, 2017 at 8:43 pm #25626Thanks for the help. I have made some adjustments that has taken me almost there, however each row is in it’s own table with it’s own header row.
Being a little dim, I know something is just not right but I cannot see it. The page is still in the same page as in my previous message, I have replied to the email sent from the forum with the code I have.
If you can just point out the format issue I should be out of your hair for a while.
Thanks
ChrisChris HirstJanuary 7, 2017 at 9:29 pm #25628Hi Chris,
I won’t receive replies to that e-mail. Could you get in touch via this contact form or upload the template to a public code sharing site (e.g. gist)?
Stephen HarrisJanuary 7, 2017 at 10:04 pm #25629Stephen,
I have just sent a message through the contact form with a txt file attached with the page code as I have it as requested.Any help to bring this table under control would be greatly appreciated.
Thanks
ChrisChris HirstJanuary 9, 2017 at 3:04 pm #25641Thanks Chris,
The biggest issue was simply that you had the table headers within the
while
loop, so they were printed for each row.Try this edited version:
<?php global $eo_event_loop; //Date % Time format for events $date_format = get_option( 'date_format' ); $time_format = get_option( 'time_format' ); ?> <?php if ( $eo_event_loop->have_posts() ): ?> <?php if ( $eo_event_loop->max_num_pages > 1 ) : //See http://codex.wordpress.org/Function_Reference/paginate_links $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ), 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $eo_event_loop->max_num_pages ) ); endif; ?> <div class="container"> <table class="table table-hover"> <thead> <tr> <th>Event</th> <th>Date</th> <th>Venue</th> <th>Category</th> <th>Book</th> </tr> </thead> <tbody> <?php while ( $eo_event_loop->have_posts() ): $eo_event_loop->the_post(); ?> <tr valign="middle" id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <td> <div class="entry-title" style="display: inline;"> <a href="<?php the_permalink(); ?>"> <?php //If it has one, display the thumbnail if ( has_post_thumbnail() ) the_post_thumbnail( 'thumbnail', array( 'style'=>'float:left;margin-right:20px;' ) ); //Display the title the_title(); ?> </a> </div> </td> <td> <!-- Output the date of the occurrence--> <?php //Format date/time according to whether its an all day event. //Use microdata http://support.google.com/webmasters/bin/answer.py?hl=en&answer=176035 if ( eo_is_all_day() ) { $format = 'd F Y'; $microformat = 'Y-m-d'; } else { $format = 'd F Y '.get_option( 'time_format' ); $microformat = 'c'; }?> <time itemprop="startDate" datetime="<?php eo_the_start( $microformat ); ?>"><?php eo_the_start( $format ); ?></time> </td> <td><!-- event venue --> <a href="<?php eo_venue_link(); ?>"> <?php eo_venue_name(); ?></a> </td> <td><!-- Event category --> <?php if ( get_the_terms( get_the_ID(), 'event-category' ) ) { ?> <?php echo get_the_term_list( get_the_ID(),'event-category', '', ', ', '' ); ?> <?php } ?> </td> <td> <a href="<?php the_permalink(); ?>">Book</a> </td> </tr> <?php endwhile; ?> </tbody> </table> </div> <?php if ( $eo_event_loop->max_num_pages > 1 ) : //See http://codex.wordpress.org/Function_Reference/paginate_links $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ), 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $eo_event_loop->max_num_pages ) ); endif; ?> <?php endif; ?>
Stephen HarrisJanuary 10, 2017 at 11:44 am #25650Doh!
I just knew it was something simple. Thanks very much for your help on this oneChris Hirst -
AuthorPosts