Skip to content

Instantly share code, notes, and snippets.

View mustardBees's full-sized avatar

Phil Wylie mustardBees

View GitHub Profile
@markoheijnen
markoheijnen / walker-page-parent-only.php
Created October 23, 2012 16:23
This walker for WordPress gives you the ability to only show the items that are selected
<?php
/**
* Create HTML list of pages.
*
* @package WordPress
* @since 2.1.0
* @uses Walker
*/
class Walker_Page_Parent_Only extends Walker {
@joshbetz
joshbetz / nav_walker_nav_menu.php
Last active December 12, 2015 01:08
WordPress nav menu without lists.
<?php
class v12_Walker_Nav_Menu extends Walker_Nav_Menu {
function __construct() {
add_filter( 'wp_nav_menu_args', array( __CLASS__, 'items_wrap' ) );
}
/**
* @see wp_nav_menu()
<?php
$query = get_posts( array( 'posts_per_page' => 1, 'fields' => 'ids' ) );
@nacin
nacin / auto-update.php
Last active March 11, 2019 17:17
This is how @dd32 and I test automatic background updates in WordPress 3.7. Then just do example.com/?wp_maybe_auto_update. (If you use a checkout of develop.svn.wordpress.org, you can run this on the `build` directory, then simply run `grunt copy` between updates to copy over the latest code from `src`. This is how we are able to make adjustmen…
<?php
// Add this as a mu-plugin.
if ( isset( $_GET['wp_maybe_auto_update'] ) ) {
add_filter( 'automatic_updates_is_vcs_checkout', '__return_false' );
add_action( 'template_redirect', function() {
$time = date( 'r' );
echo "Starting... $time<br />";
delete_site_option( 'auto_core_update_failed' );
@craigmdennis
craigmdennis / gallery.bxslider.html
Created November 1, 2011 16:48
A BX Slider configuration that uses 2 separate sliders. One for the gallery and one for the thumbs.
<?php
/*
Plugin Name: Convert SMURF to CMB2 repeatable field groups
Plugin URI: http://www.iweb.co.uk/
Description: Go through and zero index each SMURF array.
Version: 1.0.0
Author: iWeb
Author URI: http://www.iweb.co.uk/
*/
@mustardBees
mustardBees / pw_convert_pw_gallery_to_file_list.php
Last active February 18, 2020 16:02
Convert pw_gallery to file_list
// *******************************
// Make Gutenberg Sidebar Wider / Fluid
// -------------------------------
function wider_gutenberg_settings_sidebar() { ?>
<style>
@media (min-width: 1080px) {
#wpwrap .edit-post-layout.is-sidebar-opened .components-notice-list {
right: 26vw !important;
}
#wpwrap .edit-post-layout.is-sidebar-opened .edit-post-plugin-sidebar__sidebar-layout,
@hereswhatidid
hereswhatidid / custom-acf-wysiwyg-css.php
Last active September 27, 2022 15:27
Applies defined CSS classes to the ACF WYSIWYG editor so that you can individually style them.
<?php
function hwid_acf_admin_footer() {
?>
<script>
( function( $) {
acf.add_filter( 'wysiwyg_tinymce_settings', function( mceInit, id ) {
// grab the classes defined within the field admin and put them in an array
var classes = $( '#' + id ).closest( '.acf-field-wysiwyg' ).attr( 'class' );
@dlh01
dlh01 / distribute_user.sh
Last active June 27, 2023 20:25
WP-CLI: Add a user to all sites in a network
#!/bin/bash
# Usage: ./distribute_user.sh [username] [role]
ARGS="$@"
echo "Adding user $1 as $2 to all sites"
SITES=$(wp site list --field=url --format=csv)
for site in $SITES
do