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
// 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' );
}
<?php
// Get the global `$wp_query` object.
$id = get_the_ID();
// Get the semantic_linkbacks_type 'like'.
$comments = get_linkbacks( 'like', $id );
?>
<section class="section">
<div class="container">
<ul class="pile likes">
<li class="icon">
@miklb
miklb / link.php
Last active April 12, 2017 16:25
attempting to get last a tag and apply a class
@miklb
miklb / Frankenstein.php
Last active May 19, 2017 06:01
facepiles for WP comments
/**
* Override core Walker_Comment for mf2 & Bulma.
*
* @method __construct
*/
class Independence_Walker_Comment extends Walker_Comment {
/**
* Start the element output.
*
* This opens the comment. Will check if the comment has children or is a stand-alone comment.
@miklb
miklb / searchform.php
Created March 20, 2017 01:55
current theme searchform
<form role="search" method="get" id="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<p class="control has-addons">
<input class="input" name="s" id="search" type="search" value="<?php echo esc_attr( get_search_query() ); ?>" placeholder="Find it now!">
<button class="button is-info" type="submit">
Search
</button>
</p>
</form>
function twithandle( $content ) {
$twithandle = preg_replace( '/([^a-zA-Z0-9-_&])@([0-9a-zA-Z_]+)/','$1<a href="https://twitter.com/$2" rel="nofollow">@$2</a>',$content );
return $twithandle;
}
add_filter( 'the_content', 'twithandle' );
add_filter( 'comment_text', 'twithandle' );
@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;
@miklb
miklb / micropub.log
Last active December 13, 2016 16:53
// relevant part from Quill
properties:
{ content: [Object],
category: [Object],
'syndicate-to': [Object] }
// relevant part from Inkstone
properties: { content: [Object] },
mp: {
type: [Object],
@miklb
miklb / .imdoneignore
Created October 18, 2016 21:03
memo to self for how imdone ignore file needs to be pattern matched
site/vendor/**/*
site/config/**/*
site/web/wp/**/*
site/web/app/plugins/**/*
!site/web/app/plugins/chapel_plugin/**/*
response = Net::HTTP.post_form(uri, 'target' => "#{target}", 'source' => "#{source}")
source = "#{source}"
source_slug = source.split('/')[-1]
file_ext = '.json'
source_file = [source_slug, file_ext].join("")
source_path = File.join("_data", source_file)
File.write(source_path,response.body)