Skip to content

Instantly share code, notes, and snippets.

Peter Wilson peterwilsoncc

Block or report user

Report or block peterwilsoncc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@peterwilsoncc
peterwilsoncc / remove-caps.php
Created Sep 30, 2019
Remove all caps unrelated to posts for all WordPress accounts.
View remove-caps.php
<?php
/* ********************************************************* *
* WARNING WARNING WARNING! *
* Written in about ten minutes, only roughly tested. *
* ********************************************************* */
/**
* Do not allow meta caps unrelated to posts.
*
* @param string[] $caps Array of required capabilities.
@peterwilsoncc
peterwilsoncc / index.php
Created Oct 17, 2011
WordPress - output page title on is_home() when displaying news on a sub page
View index.php
<?php
if ( (is_home()) && (get_option('show_on_front') == 'page') && (get_option('page_for_posts') != 0) ) {
echo '<h1>' . esc_html(get_the_title(get_option('page_for_posts'))) . '</h1>';
}
?>
@peterwilsoncc
peterwilsoncc / plugin-comment-reply.js
Last active May 18, 2019
Replacing WordPress's comment code to move the comment reply form.
View plugin-comment-reply.js
// 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
Created Apr 29, 2019
Firefox user styles for maintaining sanity.
View userContent.css
@-moz-document url-prefix(https://www.abc.net.au/news),
domain(www.linkedin.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;
left: 0 !important;
@peterwilsoncc
peterwilsoncc / functions.php
Last active Jan 21, 2018 — forked from maddisondesigns/functions.php
Remove Yoast SEO nag after update
View functions.php
<?php
class ahRemoveYoastNag_Remove_Yoast_SEO_Nag {
private $yoastPluginFile;
public function __construct() {
$this->yoastPluginFile = "wordpress-seo/wp-seo.php";
View functions.php
<?php
/**
* Register assets required by the theme.
*/
function pwcc_register_assets() {
wp_register_style(
'pwcc-styles',
get_stylesheet_uri(),
array(),
@peterwilsoncc
peterwilsoncc / livereload.php
Created Mar 22, 2012
Live reload WordPress extension
View livereload.php
<?php
/*
Plugin Name: LiveReload
Description: Adds the JavaScript for LiveReload to a WordPress site
Version: 0.0.0.0.1alpha
Author: Peter Wilson
Author URI: http://peterwilson.cc/
*/
@peterwilsoncc
peterwilsoncc / index.php
Created Jun 17, 2016
get post class test
View index.php
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
// post_class();
?>
<p><?php the_ID(); ?></p>
<?php
endwhile;
?>
@peterwilsoncc
peterwilsoncc / js-starter-file.js
Created Jun 20, 2013
JavaScript starter file
View js-starter-file.js
PWCC = this.PWCC || {};
console = this.console || {};
console.log = this.console.log || function(){};
console.error = this.console.error || function(){};
(PWCC.exe = function(window, document, $) {
var html = document.documentElement,
body = html.getElementsByTagName('body')[0];
View 0500up.scss
html {
color: black;
@include lte8 {
color: #111;
}
}
You can’t perform that action at this time.