Skip to content

Instantly share code, notes, and snippets.

View miklb's full-sized avatar
🎣
Gone Fishing

Michael Bishop miklb

🎣
Gone Fishing
View GitHub Profile
@miklb
miklb / gist:2898758
Created June 9, 2012 00:05
Basic WP_Query
$loop = new WP_Query (array(
'cat' => '1',
'posts_per_page'=> -1
));
@miklb
miklb / gist:2919525
Created June 12, 2012 19:13
Filter WordPress Image & Caption to use HTML5 figure
/**
*
* @author pixeline
* @link https://github.com/eddiemachado/bones/issues/90
*
*/
/* Remove Width/Height attributes from images, for easier image responsivity. */
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );
@miklb
miklb / user.php
Created June 21, 2012 06:48
example user.php file for Habari
<div class="author-box">
<h3><?php echo $content->info>displayname; ?></h3>
<?php if ( isset ( $content->info->imageurl ) ) { ?><img src="<?php echo $content->info->imageurl; ?>" alt="<?php echo $content->displayname; ?>" class="auth-img"><?php } ?>
<?php if ( isset ( $content->info->bioblurb ) ) { ?><p><?php echo $content->info->bioblurb; ?></p><?php } ?>
</div>
@miklb
miklb / plugin.xml
Last active October 6, 2015 16:38
Habari Plugin XML Template
<?xml version="1.0" encoding="utf-8" ?>
<pluggable type="plugin" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schemas.habariproject.org/pluggable/0.8">
<name></name>
<license url="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0</license>
<author url="http://miklb.com">Michael Bishop</author>
<version>0.1</version>
<url>http://miklb.com/</url>
<description><![CDATA[Description of plugin goes here.]]></description>
<copyright>2013</copyright>
@miklb
miklb / gist:3022553
Created June 30, 2012 06:06
modified bookmarklet for Habari's Publish Quote plugin
javascript:var%20w=window,d=document,gS='getSelection';window.open('http://example.com/admin/publish?quote='+encodeURIComponent((''+(w[gS]?w[gS]():d[gS]?d[gS]():d.selection.createRange().text)).replace(/(^\s+|\s+$)/g,''))+'&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(d.title.replace(/\u200b/g, '')));void(0);
@miklb
miklb / theme.php
Created July 5, 2012 21:49
Modify Habari plugin Jambo formUI
public function action_modify_form_jambo ( $form ) {
$this->add_template('canon_submit', dirname(__FILE__).'/forms/formcontrol_submit.php', true);
$this->add_template( 'canon_email', dirname(__FILE__).'/forms/formcontrol_email.php' );
$form->jambo_submit->template = 'canon_submit';
$form->jambo_email->template = 'canon_email';
$form->append( 'fieldset', 'jambo_commenterinfo', _t( 'Have a Question?' ) );
$form->move_before( $form->jambo_commenterinfo, $form->jambo_name );
$form->jambo_name->move_into($form->jambo_commenterinfo);
$form->jambo_email->move_into( $form->jambo_commenterinfo );
$form->jambo_message->move_into( $form->jambo_commenterinfo );
@miklb
miklb / gist:4570013
Created January 19, 2013 00:54
trying to insert hard line break
$content .=$itemopen . '### [' . $bookmark->title . '](' . $bookmark->url . ') "\n"' . $bookmark->description . '"\n"';
@miklb
miklb / dabblet.css
Created March 17, 2013 09:41 — forked from michaeltwofish/dabblet.css
tiger in the snow (HTML5)
/**
* tiger in the snow (HTML5)
*/
figure {
min-width: 178px;
/** outline: solid 1px red; /* uncomment rule to see figure outline */
position: relative;
}
img:hover {
@miklb
miklb / markdown_link
Last active December 13, 2016 22:52
Simple pair of TextExpander snippets to grab the frontmost URL in Safari, copy it to the clipboard then make a markdown link from it. I needed this because I use a Popclip extension that allows me to copy selected text from a page and make a new note in nvAlt. Doing so takes me away from the browser, and I wanted a quick and handy way to create …
public function filter_post_featuredimage_image($featuredimage_image, $post)
{
if ($post->content_type == Post::type('entry')) {
if (!empty($post->info->featuredimage_image)) {
return $post->info->featuredimage_image;
}
preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->content, $matches);
if (sizeof($matches[1]) > 0) {