Q: how to create conditional placeholder from sql function?
-
I have used PODS to create the possibility to add performers to the events, because to me that is one of the biggest missing items.
I am able to add code to the event-single.php file, which will then show me all performers for this event.
But this means I need to format the output in this file, while I want it to be part of the template system.
So, how can I change this sql-code into a conditional placeholder? I went through the events manager documentation but that is not really clear about what to do.
This is the code I’m using in case anyone is interested.
function show_performer() {
//get Pods object for current post
$pod = pods( ‘event’, get_the_id() );
//get the value for the relationship field
$related = $pod->field( ‘related_performer’ );//loop through $related, retrieve all performer names and links to detailpage
// Check if at least one performer is linked to the event
if (!empty($related)) {
// There is at least one performer
foreach ($related as $rel) {$performer_name = $rel[‘post_title’];
$performer_link = $rel[‘guid’];echo($performer_name.’:’.$performer_link.'<br/>’);
}
}
}
- The topic ‘Q: how to create conditional placeholder from sql function?’ is closed to new replies.