Skip to content

Instantly share code, notes, and snippets.

View peterwilsoncc's full-sized avatar

Peter Wilson peterwilsoncc

View GitHub Profile
@peterwilsoncc
peterwilsoncc / plugin-comment-reply.js
Last active May 18, 2019 03:03
Replacing WordPress's comment code to move the comment reply form.
// After WP Core's comment-reply.js is loaded.
(function () {
if ( typeof addComment === 'undefined' ) {
return;
}
// Source: Jetpack comments module by Automattic.
// See https://github.com/Automattic/jetpack/blob/2e9efb22810cbd0e60ad2d2a9158e47a4432577c/modules/comments/comments.php#L375-L413
addComment._myPlugins_moveForm = addComment.moveForm;
@peterwilsoncc
peterwilsoncc / userContent.css
Last active November 3, 2020 03:49
Firefox user styles for maintaining sanity.
@-moz-document url-prefix(https://www.abc.net.au/news),
domain(www.linkedin.com),
domain(twitter.com),
domain(www.theage.com.au),
domain(www.smh.com.au) {
html::before {
content:"It's all terrible and depressing." !important;
display: block !important;
position: fixed !important;
top: 0 !important;
@peterwilsoncc
peterwilsoncc / index.php
Created June 17, 2016 03:58
get post class test
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
// post_class();
?>
<p><?php the_ID(); ?></p>
<?php
endwhile;
?>
<?php
/**
* Register assets required by the theme.
*/
function pwcc_register_assets() {
wp_register_style(
'pwcc-styles',
get_stylesheet_uri(),
array(),
@peterwilsoncc
peterwilsoncc / functions.php
Last active January 21, 2018 15:01 — forked from maddisondesigns/functions.php
Remove Yoast SEO nag after update
<?php
class ahRemoveYoastNag_Remove_Yoast_SEO_Nag {
private $yoastPluginFile;
public function __construct() {
$this->yoastPluginFile = "wordpress-seo/wp-seo.php";
"\uD83D\uDC3C\uD83C\uDDE8\uD83C\uDDF3"
@peterwilsoncc
peterwilsoncc / keyring-importer-instagram.php.diff
Last active August 29, 2015 14:17
Keyring social importer - set post type
--- keyring-importer-instagram.php
+++ (clipboard)
@@ -55,7 +55,11 @@
// First import starts from now and imports back to day-0.
// Auto imports start from the most recently imported and go up to "now"
+
+ $post_type = apply_filters( 'keyring_post_type', 'post', static::SLUG );
+
$latest = get_posts( array(
@peterwilsoncc
peterwilsoncc / wp-seo-metabox.diff
Created March 14, 2015 04:03
Fixing the JS error in WP SEO.
diff --git a/content/plugins/wordpress-seo/js/wp-seo-metabox.js b/content/plugins/wordpress-seo/js/wp-seo-metabox.js
index ecbbf24..62a6a46 100644
--- a/content/plugins/wordpress-seo/js/wp-seo-metabox.js
+++ b/content/plugins/wordpress-seo/js/wp-seo-metabox.js
@@ -282,12 +282,12 @@ function yst_updateDesc() {
snippet.find('.desc span.content').html('');
yst_testFocusKw();
- if (tinyMCE.get('excerpt') !== null) {
+ if ( window.tinyMCE && tinyMCE.get('excerpt') !== null) {
@peterwilsoncc
peterwilsoncc / micropubfilter.php
Created February 11, 2015 02:50
Include trashed posts in url_to_postid
<?php
function micropub_url_to_postid($url) {
global $wp_rewrite;
/**
* Filter the URL to derive the post ID from.
*
* @since 2.2.0
*
@peterwilsoncc
peterwilsoncc / 100-some-template.json
Last active August 29, 2015 14:05
Pattern lab data file question. Is it possible to include the same atom multiple times & have a json file deal with it?
{
"forms" : {
"textInput" : {
"name" : "textInput", // needs to differ for each instance
"id" : "textInput" // needs to differ for each instance
}
}
}
// some code in here to allow for multiple instances