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
/**
* Featured image in atom feed.
* @method featuredtoRSS
* @param $string $content post content.
* @return $string $content updated content w/image.
*/
function independence_featuredtorss( $content ) {
global $post;
if ( has_post_thumbnail( $post->ID ) ) {
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array(
@miklb
miklb / test.md
Created September 18, 2017 16:35
Testing markdown

Heading

List

  • one
  • two
  • three

Strong

Italic

@miklb
miklb / post-formats.php
Created August 6, 2017 02:58
function to map mf2 types to post formats props @dshanske
function mf2_s_template_type() {
if (function_exists('get_post_kind') )
{
/* Use kinds for specific templates
*/
$name = get_post_kind_slug();
}
else {
/* Otherwise use post formats for templates
* For those post formats that have post kind
@miklb
miklb / template-tags.php
Created July 9, 2017 01:47
Custom function to allow me to paginate using Bulma markup.
function independence_bulma_pagination($pages = '', $range = 2)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
{
global $wp_query;
a:3:{s:4:"html";s:135:"
<div class="hide"><pre>stdClass::__set_state(array(
'links' =&gt;
array (
),
))</pre></div>
";s:5:"value";s:61:"stdClass::__set_state(array(
'links' =>
@miklb
miklb / functions.php
Last active July 2, 2017 12:18
function to add h-entry to post class
function my_post_classes( $classes ) {
$classes = array_diff( $classes, array( 'hentry' ) );
if ( 'page' !== get_post_type() ) {
// Adds a class for microformats v2
$classes[] = 'h-entry';
// add hentry to the same tag as h-entry
$classes[] = 'hentry';
}
@miklb
miklb / kind-reply.php
Created July 1, 2017 17:35
custom post-kind template to deal with rich twitter embed and adding u-url to link
<?php
/**
* Quote Kind Reply.
*
* @package independence
*/
?>
<?php
@miklb
miklb / README.md
Created May 25, 2017 22:07
@18F README boilerplate. Still looking for the canonical home of this file, but it's a great starting document

CFPB Open Source Project Template Instructions

  1. Create a new project.
  2. Copy these files into the new project
  3. Update the README, replacing the contents below as prescribed.
  4. Add any libraries, assets, or hard dependencies whose source code will be included in the project's repository to the Exceptions section in the TERMS.
  • If no exceptions are needed, remove that section from TERMS.
  1. If working with an existing code base, answer the questions on the open source checklist
  2. Delete these instructions and everything up to the Project Title from the README.
<?php
/*
Default Template
* The Goal of this Template is to be a general all-purpose model that will be replaced by customization in other templates
*/
$kind = get_post_kind_slug( get_the_ID() );
$meta = new Kind_Meta( get_the_ID() );
$author = Kind_View::get_hcard( $meta->get_author() );
$cite = $meta->get_cite();
// Your theme probably already has a function to enqueue_scrpts scripts in functions.php
// You should just be able to add the deregister/dequeue to that
function independence_scripts() {
wp_deregister_style( 'kind' );
wp_dequeue_style( 'kind' );
wp_deregister_style( 'indieweb' );
wp_dequeue_style( 'indieweb' );
}