<div class="outer-container"> <main class="main-body"> <h2 class="page-title">Handy links from around the web</h2> <p>It's early days. And we promise, at some stage, the following will be sorted much better, but here is a list of some great Perch resources from around the web. If you've got something to add, email <a href="mailto:hello@perchd.io">hello@perchd.io</a>.</p> <?php $tags = get_tags(); echo '<div class="tags">'; $active = perch_get('tag') == null ? ' active' : ''; echo '<a class="btn--secondary ' . $active . '" href="/links">All</a> '; foreach ($tags as $tag) { $active = perch_get('tag') == $tag ? ' active' : ''; echo '<a class="btn--secondary' . $active . '" href="/links?tag=' . $tag . '">' . ucfirst(substr($tag, 6)) . '</a> '; } echo '</div>'; $items = pinboard_bookmarks('perch ' . perch_get('tag')); foreach ($items as $item) { echo '<article class="post--extended">'; echo '<header class="post__header"><h3 class="post__title"><a href="' . $item['url'] . '">' . $item['title'] . '</a></h3>'; //echo '<div class="post__byline"><time class="dt-published">'.$item['date'].'</time></div></header>'; echo '<div class="post__content"><p>' . $item['description'] . '</p></div>'; echo '</article>'; echo '<hr />'; } ?> </main> <?php perch_layout('sidebar'); ?> </div>
function widget_pinboard($args, $number = 1) { global $pinboard_options; // $args is an array of strings that help widgets to conform to // the active theme: before_widget, before_title, after_widget, // and after_title are the array keys. Default tags: li and h2. extract($args); // Each widget can store its own options. We keep strings here. include_once ABSPATH . WPINC . '/rss.php'; $options = get_option('widget_pinboard'); // fill options with default values if value is not set $item = $options[$number]; foreach ($pinboard_options['widget_fields'] as $key => $field) { if (!isset($item[$key])) { $item[$key] = $field['default']; } } $bookmarks = fetch_rss($pinboard_options['rss_url'] . $username); // These lines generate our output. echo $before_widget . $before_title . '<a href="http://pinboard.in/u:' . $item['username'] . '" class="pinboard_title_link">' . $item['title'] . '</a>' . $after_title; pinboard_bookmarks($item['username'], $item['num'], true, $item['update'], $item['tags'], $item['filtertag'], $item['displaydesc'], $item['nodisplaytag'], $item['globaltag'], $item['encode_utf8']); echo $after_widget; }