Skip to content

Instantly share code, notes, and snippets.

Ulrich Pogson grappler

Block or report user

Report or block grappler

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
@grappler
grappler / woocommerce-show-products-ids.php
Created Sep 20, 2018 — forked from corsonr/gist:5947181
Show WooCommerce product ID in a custom column on products list page
View woocommerce-show-products-ids.php
<?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
Remove all traces of the classic editor in Gutenberg
View disable-classic-editor.php
<?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 );
View 54.191.137.17.logs
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
View Theme-Sniff-Issue-Format
[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:
View shortcode.php
<?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',
View customizer.php
<?php
/**
* Checks for the Customizer.
*/
class CustomizerCheck implements themecheck {
protected $error = array();
function check( $php_files, $css_files, $other_files) {
View wpzoo_edd_is_active_customer.php
<?php
/*
* Check if user has a valid subscription
*/
function wpzoo_edd_is_active_customer( $user_id = '' ) {
// Fail gracefully if EDD Software Licencing not active
if ( ! function_exists('edd_software_licensing') ) {
return;
}
$license_keys = edd_software_licensing()->get_license_keys_of_user( $user_id );
View tabs.js
document.addEventListener('DOMContentLoaded', function(){
var tabs = {
tab1: document.getElementById('tab-link-1'),
tab2: document.getElementById('tab-link-2'),
tab3: document.getElementById('tab-link-3'),
tab4: document.getElementById('tab-link-4')
}
var content = {
View Disambiguation.md

Adding context to strings

A word or phrase may be ambiguous to a translator who will likely only see the string in the interface of their translation tool and not necessarily on the front-end of your theme. Ambiguity can arise when a term is used in more than one context.

The functions _x() or _ex() are used to add the context to a string. They are similar to __() and _e(), but have a comment as an additional argument.

The function can be used in differnt ways

  • Explain the use for words with double meaings
  • Give extra information about the string
View git-sync.md

Clone repo

Run following code to clone from GitHub. git clone git@github.com:grappler/WPZOO.git

Install dependencies

Run composer to install the dependencies composer install

You can’t perform that action at this time.