public function widget($args, $instance) { $title = apply_filters('widget_title', $instance['title']); $events = \Club\Admin\Calendar\Event::getAll(new \DateTime(), $instance["num_events"]); // before and after widget arguments are defined by themes echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } // This is where you run the code and display the output ?> <table> <thead> <tr> <th>Datum</th> <th>Titel</th> </tr> </thead> <tbody> <?php foreach ($events as $event) { ?> <tr> <td><a href="<?php echo get_permalink($event->getPostId()); ?> "><?php echo $event->getFromFormated(false); ?> </a></td> <td><a href="<?php echo get_permalink($event->getPostId()); ?> "><?php echo $event->getTitle(); ?> </a></td> </tr> <?php } ?> </tbody> </table> <?php echo $args['after_widget']; }
<div class="bootstrap-wrapper"> <div class="container-no-padding container"> <table class="table table-hover table-striped"> <thead> <tr> <th>Datum</th> <th>Titel</th> <th>Ort</th> <th> </th> </tr> </thead> <tbody> <?php foreach (\Club\Admin\Calendar\Event::getAll(new \DateTime()) as $event) { ?> <tr> <td><?php echo $event->getFromFormated() . " - " . $event->getToFormated(); ?> </td> <td><?php echo $event->getTitle(); ?> </td> <td><?php echo $event->getPlace()->getName(); ?> </td> <td><a href="<?php echo get_permalink($event->getPostId()); ?>
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ use Club\Admin\Calendar\Event; global $wpdb; //var_dump(get_categories()); $events = Event::getAll(); ?> <div class="bootstrap-wrapper"> <div class="container"> <h1>Club Termine</h1> <table class="table table-hover table-striped"> <thead> <tr> <th>Name</th> <th>Von</th> <th>Bis</th> <th>Artikel</th> <th> </th> </tr> </thead> <tbody> <?php foreach ($events as $event) { ?> <tr>