function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $max_columns = $instance['max_columns']; $sex = $instance['sex']; $show_sex = isset($instance['show_sex']) ? $instance['show_sex'] : false; $readings = Read::all(Read::Begun); if (count($readings) > 0) { echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } foreach ($readings as $read) { echo '<div class="reading">'; if ($read['link'] !== '') { echo '<a href="' . $read['link'] . '">'; } if ($read['illustration']) { echo '<img src="' . $read['illustration'] . '" />'; } echo '<b>' . $read['title'] . '</b>'; if ($read['link'] !== '') { echo '</a>'; } echo '<br />' . $read['author']; echo '</div>'; } echo $after_widget; } }
<hr /> <h3>Current readings</h3> <?php $readings = Read::all(Read::Begun); if (count($readings) > 0) { include TEMPLATES_DIR . 'read/_readings.php'; } else { echo '<p>No current readings.</p>'; } ?> <h3>Finished readings</h3> <?php $readings = Read::all(Read::Done); if (count($readings) > 0) { include TEMPLATES_DIR . 'read/_readings.php'; } else { echo '<p>No finished readings.</p>'; } ?> <hr /> <div class="attribution"> Icons by <a href="http://glyphicons.com">glyphicons.com</a>. </div> </div>