Skip to content

Instantly share code, notes, and snippets.


Matthew Fitzsimmons fitzage

View GitHub Profile

Keybase proof

I hereby claim:

  • I am fitzage on github.
  • I am fitzage ( on keybase.
  • I have a public key ASCnBqQ6NkuBoCyI-VxknLarbG521-xL_OYtijCCUd-pWQo

To claim this, I am signing this object:

fitzage / lastnotfuture.php
Created Apr 11, 2013
Kirby plugin to pull a specified number of posts either from a specific category, tag, or just in general that are the latest ones excluding any posts that are in the future. The date format is set for my blog post date format, but you can modify it to fit your needs. Use either a 'category' or 'tag' option to specify a category or tag, and use …
View lastnotfuture.php
function latestnotfuture($articles, $options=array()) {
global $site;
$defaults = array(
'category' => '',
'num' => '1',
'dateformat' => 'Y-m-d H:i',
fitzage / truncate.php
Last active Oct 9, 2015
Kirby plugin to truncate by number of words and preserve tags. Works with Kirby v2.
View truncate.php
function truncate($input, $numwords, $padding="")
$output = strtok($input, " \n");
while(--$numwords > 0) $output .= " " . strtok(" \n");
if($output != $input) $output .= $padding;
// Original PHP code by Chirp Internet:
// Please acknowledge use of this code by including this header.
$opened = array();