How do I make the printf command link? (creating venue list page)
-
After 4 years of not using a nenue listing page because it broke my template, ive finally cleaned up the code and put it in my template. Im so close to getting it to look like what i want, but i need the printf output of the venue name to actually link to the venues page, not just output text. Also I would like the printf text output for the next 5 events to link to the actual events as well, not just output text. Heres the code I have so far… Im sure its something small im missing to make them link
<div id=”primary”>
<div id=”content” role=”main”><?php
$venues = eo_get_venues();
if( $venues ):
foreach( $venues as $venue )://IMPORTANT: Make sure venue ID is an integer (If its a string, it will be interpreted as a slug).
$venue_id = (int) $venue->term_id;printf(‘<article id=”venue-%d”>’, $venue_id );
/* Display venue name and address */
echo ‘<header class=”entry-header”>’;
printf(‘<h2> %s </h2>’, eo_get_venue_name($venue_id) );$address = array_filter(eo_get_venue_address($venue_id));
echo implode(‘, ‘,$address);
echo ‘</header>’;/* Display venue description & map */
echo ‘<div class=”entry-content”>’;echo eo_get_venue_map($venue_id);
/* Display next 5 events */
$events = eo_get_events(array(
‘numberposts’=>5,
‘event_start_after’=>’now’,
‘tax_query’=>array(array(
‘taxonomy’=>’event-venue’,
‘field’=>’id’,
‘terms’=>array($venue_id),
))
));
if( $events ){
echo ‘<h2> Next 5 events </h2>’;
echo ‘- ‘;
- %s on %s
foreach ($events as $event ){
printf(‘‘, get_the_title($event->ID), eo_get_the_start(‘jS F Y’, $event->ID,null,$event->occurrence_id));
}
echo ‘‘;
}echo'</div>’;
echo'</article>’;endforeach;
endif;?>
</div><!– #content –>
</div><!– #primary –>
- The topic ‘How do I make the printf command link? (creating venue list page)’ is closed to new replies.