Hi, I copied a query from one of the forums but my event espresso codes are not working within the loop for the query. The wordpress code is working (the_title() etc, but the code after the title is not.. What did I do wrong?
<?php
$atts = array(
‘title’ => NULL,
‘limit’ => 12,
‘css_class’ => NULL,
‘show_expired’ => FALSE,
‘month’ => NULL,
‘category_slug’ => NULL,
‘order_by’ => ‘start_date’,
‘sort’ => ‘ASC’
);
// run the query
global $wp_query;
$wp_query = new EE_Event_List_Query( $atts );
if (have_posts()) : while (have_posts()) : the_post();
?>
When posting code on the forums, its much better to either create a gist or use something like pastebin and post the URL here for us to view. The forum adds formatting to the code which makes it much harder to read, its actually not to bad for the above but would still be easier within either of the 2 options above.
// is a single lin comment within PHP which means that line is actually set to do nothing, which means there is nothing other the_title() within your loop.
I FTP’d onto your server, downloaded, and combed through the page-agenda.php template. There were a number of corrections that needed to be made. Here’s a gist of the template, with some corrections:
Thanks to Tony for the tip on the gist. And yes, the code was deactivated, I should have removed that before I asked my question here. 🙂
Thanks to Josh for the swift and excellent corrections.. I seee where I messed up. Thanks for the gist, it’s working great now.
Viewing 3 reply threads
The support post ‘Why is event espresso code not working in my loop?’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.