Skip to content

Instantly share code, notes, and snippets.

@bewho
bewho / register-post-type.php
Created December 8, 2017 03:16 — forked from justintadlock/register-post-type.php
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@bewho
bewho / wp-config.php
Created December 8, 2017 03:36 — forked from curtisbelt/wp-config.php
wp-config for Re-usable Wordpress Installation
<?php
/******************************************** // <-- Add a dash to turn on debugging
// define( 'WP_DEBUG', true );
// define( 'WP_DEBUG_LOG', true );
// define( 'WP_DEBUG_DISPLAY', true );
error_reporting(E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR);
ini_set('display_errors', 1);
// define( 'SCRIPT_DEBUG', true );
@bewho
bewho / wp-config.php
Created December 8, 2017 03:51 — forked from bhubbard/wp-config.php
A Custom Template for wp-config.php.
<?php
################################################################################
// Custom WP-CONFIG Template.
################################################################################
################################################################################
// For Quick Client Reference
################################################################################
// Client Name:
// Salesforce URL:
@bewho
bewho / functions.php
Created December 8, 2017 03:53 — forked from lukecav/functions.php
Stop WordPress sending anything but essential data during the update check
function wp_update_privacy( $query ) {
unset($query['php']);
unset($query['mysql']);
unset($query['local_package']);
unset($query['blogs']);
unset($query['users']);
unset($query['multisite_enabled']);
unset($query['initial_db_version']);
return $query;
}
@bewho
bewho / functions.php
Created December 8, 2017 03:54 — forked from lukecav/functions.php
Kill Gutenberg in WordPress
function kill_gutenberg_post_type( $is_enabled, $post_type ) {
if ( ‘post’ === $post_type || ‘page’ === $post_type ) {
return false; //==> add_action( ‘admin_print_scripts-edit.php’,…) ==> gutenberg_replace_default_add_new_button is disabled
}
return $is_enabled;
}
add_filter( ‘gutenberg_can_edit_post_type’, ‘kill_gutenberg_post_type’, 10, 2 ); //gutenberg_add_edit_link_for_post_type
function kill_gutenberg_modify_add_new_button_url( $url, $path ) {
@bewho
bewho / ngnix.config
Created December 8, 2017 07:08 — forked from lukecav/ngnix.config
Gzip enabled in NGNIX
# Enable gzip compression.
# Default: off
gzip on;
# Enable compression both for HTTP/1.0 and HTTP/1.1.
gzip_http_version 1.1;
# Compression level (1-9).
# 5 is a perfect compromise between size and CPU usage, offering about
# 75% reduction for most ASCII files (almost identical to level 9).
@bewho
bewho / toc.php
Created December 13, 2017 11:47
wordpress Table of Contents
/*-----------------------------------------------------------------------------------*/
/* Table of Contents - Shortcode */
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'woo_shortcode_table_of_contents' ) ) {
function woo_shortcode_table_of_contents ( $atts, $content = null ) {
global $post;
$defaults = array();
$atts = shortcode_atts( $defaults, $atts );
@bewho
bewho / my.cnf
Created December 13, 2017 16:08 — forked from lukecav/my.cnf
MariaDB - Performance changes
optimizer_switch='mrr=on'
optimizer_switch='mrr_sort_keys=on'
optimizer_switch='mrr_cost_based=off'
mrr_buffer_size=32M
optimizer_switch='join_cache_incremental=on'
optimizer_switch='join_cache_hashed=on'
optimizer_switch='join_cache_bka=on'
join_cache_level=4
join_buffer_size=32M
@bewho
bewho / wordpress.conf
Created December 13, 2017 16:18 — forked from lukecav/wordpress.conf
NGNIX use state cache itmes while updating in the background
#Use stale cache items while updating in the background
fastcgi_cache_use_stale updating error timeout invalid_header http_500;
fastcgi_cache_lock on;
fastcgi_cache_lock_timeout 5s;
@bewho
bewho / mime.types
Created December 13, 2017 16:21 — forked from lukecav/mime.types
NGNIX Mime Types
types {
application/atom+xml atom;
application/dart dart;
application/gzip gz;
application/java-archive jar war ear;
application/javascript js jsonp;
application/json json;
application/owl+xml owl owx;
application/pdf pdf;
application/postscript ai eps ps;