Skip to content

Instantly share code, notes, and snippets.

Herding 🐘

Juliette jrfnl

Herding 🐘
View GitHub Profile
View wp-query-ref.php
// This gist is now maintained on github at
* WordPress Query Comprehensive Reference
* Compiled by luetkemj -
* Source:
justintadlock / register-post-type.php
Last active Nov 17, 2021
Help file when registering post types.
View register-post-type.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
View index.php
function spl_push_error_handler(ErrorHandler $handler, int $level = \E_ALL, int $priority = 0): void
// this function would be built into PHP, possibly with the addition of some extra functions to inspect and remove
// existing error handlers
// pushed error handlers would take priority over an error handlers set with set_errorhandler(), which would only be called
// if the error is not handled by a handler in the stack.
mlocati / exceptions-tree.php
Created Mar 9, 2017
Throwable and Exceptions tree
View exceptions-tree.php
if (!function_exists('interface_exists')) {
die('PHP version too old');
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
if (count($throwablesPerParent) !== 0) {

Time Travel Debugging

Time Travel refers to the ability to record a tab and later replay it ([WebReplay][wrr]). The technology is useful for local development, where you might want to:

  • pause and step forwards or backwards
  • pause and rewind to a prior state
  • rewind to the time a console message was logged
  • rewind to the time an element had a certain style or layout
  • rewind to the time a network asset loaded
redoPop / .gitignore
Created Jun 18, 2010
Template .gitignore file for WordPress projects
View .gitignore
# This is a template .gitignore file for git-managed WordPress projects.
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
# See the comments below for more info on how to add exceptions for your
matheuseduardo / get-page-by-slug.php
Last active Apr 6, 2021 — forked from micahblu/gist:5786794
get_page_by_slug - wordpress
View get-page-by-slug.php
* Retrieve a page given its slug.
* @global wpdb $wpdb WordPress database abstraction object.
* @param string $page_slug Page slug
* @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
* Default OBJECT.
* @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
wpscholar / functions.php
Last active Mar 1, 2021
Enqueueing IE conditional stylesheets in WordPress the right way
View functions.php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link
ryansechrest /
Created Dec 23, 2013
Bash script to synchronize website directory and database between server and localhost or server and server.
# Created on 10/8/13 by Ryan Sechrest
# site (localhost edition)
# Program to mirror a directory and database of a website between two servers.
### Program meta data
Rarst / .scrutinizer.yml
Last active Aug 13, 2019
Scrutinizer config to install PHPUnit on the fly, without shipping in project dependencies.
View .scrutinizer.yml
- 'tests/*'
php: true
version: 7.2