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
Last active February 28, 2018 16:49
Override ZenPress header image dimensions
function zenpress_setup()
{
// This theme supports a custom header
// Change the width and height here
$cooking_header_args = array(
'width' => 1250,
'height' => 400,
'header-text' => true,
);
@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(
@miklb
miklb / UnspamWebmentions.php
Last active January 6, 2018 21:38
Unspam Webmentions in WordPress theme function
/**
* Unspam Webmentions
*
* @method unspam_webmentions
* @param [type] $approved [description].
* @param [type] $commentdata [description].
* @return [type] [description]
*/
function unspam_webmentions( $approved, $commentdata ) {
return $commentdata['comment_type'] == 'webmention' ? 1 : $approved;
/**
* 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

Keybase proof

I hereby claim:

  • I am miklb on github.
  • I am miklb (https://keybase.io/miklb) on keybase.
  • I have a public key ASCIPpnA3ebZHf7nef4SLLuHXijPbzCz84WRbkvllMWiFAo

To claim this, I am signing this object:

@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;