Skip to content

Instantly share code, notes, and snippets.

@grappler
grappler / migrate-wp-user-avatar.php
Created September 13, 2022 11:34
Allows sites to easily move away from the WP User Avatar plugin and switch to WP User Avatars instead.
<?php
/*
Migrate from WP User Avatar to WP User Avatars
Allows sites to easily move away from the WP User Avatar plugin and switch to WP User Avatars instead.
Run by invoking with WP CLI like so:
`wp eval-file migrate-wp-user-avatar.php`
Author: Ulrich Pogson
<?php
/*
Migrate from WP User Avatar to WP User Avatars
Allows sites to easily move away from the WP User Avatar plugin and switch to WP User Avatars instead.
Run by invoking with WP CLI like so:
`wp eval-file migrate-wp-user-avatar.php`
Author: Ulrich Pogson
@grappler
grappler / touchid_sudo.sh
Created February 21, 2021 11:12 — forked from RichardBronosky/touchid_sudo.sh
Use TouchID for sudo on modern MacBook Pro machines
#!/bin/bash
# curl -sL https://gist.githubusercontent.com/RichardBronosky/31660eb4b0f0ba5e673b9bc3c9148a70/raw/touchid_sudo.sh | bash
# This script is ready to copy-paste in whole, or just the line above (without the leading #)
# Use TouchID for sudo on modern MacBook Pro machines
# This script adds a single line to the top of the PAM configuration for sudo
# See: https://apple.stackexchange.com/q/259093/41827 for more info.
touchid_sudo(){
@grappler
grappler / comopser-wp-cli.md
Last active November 22, 2019 08:55 — forked from neverything/comopser-wp-cli.md
Install composer and wp-cli on cyon.ch hostings with SSH access.

Cyon.ch/Hostpoint - Install composer & wp-cli

SSH into your server and stay in the home directory of the user. Check if you have a bin directory in your user directory already, in case you do, omit the mkdir bin.

Use bin folder in $HOME for user scriptsr

For the commands to be loaded from the bin directory run echo "export PATH=$HOME/bin:$PATH" >> ~/.bashrc. For the new config to be used run source ~/.bashrc or close and reopen your SSH session.

Composer

@grappler
grappler / woocommerce-show-products-ids.php
Created September 20, 2018 08:36 — forked from corsonr/gist:5947181
Show WooCommerce product ID in a custom column on products list page
<?php
/**
* Plugin Name: WooCommerce - Show products IDs
* Plugin URI: http://www.remicorson.com/easily-find-woocommerce-products-id/
* Description: Adds a new columns to products list page to display product IDs
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5
@grappler
grappler / disable-classic-editor.php
Created May 9, 2018 08:47
Remove all traces of the classic editor in Gutenberg
<?php
/**
* Removes the classic editor actions links.
*/
add_action( 'admin_init', function() {
// For hierarchical post types.
add_filter( 'page_row_actions', 'gutenberg_remove_classic_editor_links', 10, 2 );
// For non-hierarchical post types.
add_filter( 'post_row_actions', 'gutenberg_remove_classic_editor_links', 10, 2 );
grep 54.191.137.17 staging.klinglerconsultants.ch-ssl_log
54.191.137.17 - - [12/Mar/2018:13:35:18 +0100] "GET /wp-admin/network/ HTTP/1.1" 302 0 "https://staging.acbe.ch/wp-admin/network/plugins.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
54.191.137.17 - - [12/Mar/2018:13:35:19 +0100] "GET /wp-login.php?redirect_to=https%3A%2F%2Fstaging.klinglerconsultants.ch%2Fwp-admin%2Fnetwork%2F&reauth=1 HTTP/1.1" 200 1271 "https://staging.klinglerconsultants.ch/wp-admin/network/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
54.191.137.17 - - [12/Mar/2018:13:43:39 +0100] "GET / HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
54.191.137.17 - - [12/Mar/2018:13:43:40 +0100] "GET /de/ HTTP/1.1" 200 23420 "https://staging.klinglerconsultants.ch" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Appl
[New sniff] No disabling of the admin toolbar
#### Rule:
**ERROR** : No hiding of the admin bar - check if `show_admin_bar( false )` is called or if `add_filter( 'show_admin_bar', '__return_false' )` is somewhere in the code.
Ref: https://make.wordpress.org/themes/handbook/review/required/#core-functionality-and-features
#### Theme check file covering this rule:
https://github.com/Otto42/theme-check/blob/master/checks/adminbar.php
#### To do:
<?php
function sc_menu( $atts, $content = null, $shortcode_tag = '' ) {
$bgcolors = array(
'blue' => array(
'class' => 'bg-cd-1',
'label' => __( 'Blue', 'prohelvetia' ),
),
'yellow' => array(
'class' => 'bg-cd-2',
<?php
/**
* Checks for the Customizer.
*/
class CustomizerCheck implements themecheck {
protected $error = array();
function check( $php_files, $css_files, $other_files) {