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 / functions.php
Created January 27, 2018 15:24
Wrap $content in e-content
/**
* Wraps the_content in e-content
*
*/
function mf2_s_the_content( $content ) {
if ((mf2_s_template_type()=='article')||(is_page())) {
$wrap = '<div class="entry-content e-content"><p>';
}
else {
$wrap = '<div class="entry-content e-content p-name"><p>';
@miklb
miklb / functions.php
Created January 20, 2018 15:10
function to add featured image to feed
/**
* 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(
/**
* Unspam Webmentions
*
* @method unspam_webmentions
* @param [type] $approved [description].
* @param [type] $commentdata [description].
* @return [type] [description]
*/
function unspam_webmentions( $approved, $commentdata ) {
/**
* 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