Skip to content

Instantly share code, notes, and snippets.

View cliffordp's full-sized avatar

Clifford cliffordp

View GitHub Profile
@iamntz
iamntz / update-bedrock.sh
Created January 1, 2024 07:57
quickly update bedrock-related files
#!/bin/bash
## Description: Update bedrock packages
## Usage: update-bedrock [wp|plugins|themes]
## Example: "ddev update-bedrock" or "ddev update-bedrock wp" or "ddev update-bedrock plugins" or "ddev update-bedrock themes"
## ExecRaw: true
## HostWorkingDir: true
case $1 in
wp)
@cliffordp
cliffordp / functions.php
Created October 30, 2022 18:31 — forked from tripflex/functions.php
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* Make sure the function does not exist before defining it
*/
if( ! function_exists( 'remove_class_filter' ) ){
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
@nickpelton
nickpelton / localwp-no-conflict.sh
Created July 20, 2022 20:43
zsh avoid conflicts with localwp shell and custom php, mysql, or other custom binaries
# Don't load custom stuff if LocalWP shell
if [[ -z ${PHPRC+z} ]]
then
echo "Export custom binaries"
# Eg.
# export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"
# export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"
fi
@borkweb
borkweb / .gitconfig
Created July 29, 2020 19:51
My aliases for git
[alias]
# === Common Commands ===
a = add # Shortcut for add
br = branch # Shortcut for br
branches = branch -a # Shortcut for branch -a
co = checkout # Shortcut for checkout
cob = checkout -b # Shortcut for checkout -b
cp = cherry-pick # Shortcut for cherry-pick
po = push origin # Shortcut for push origin
@earth3300
earth3300 / _wp_upload_dir-wp.php
Last active May 29, 2021 15:16
The _wp_upload_dir function that tries to do too much (and fails when you need it most).
/**
* A non-filtered, non-cached version of wp_upload_dir() that doesn't check the path.
*
* @since 4.5.0
* @access private
*
* @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
* @return array See wp_upload_dir()
*/
function _wp_upload_dir( $time = null ) {
@jaredatch
jaredatch / mailhog-mamp.md
Created January 30, 2018 21:57
Install MailHog with MAMP Pro

Install MailHog with MAMP Pro, using HomeBrew.

MailHog

First let's make sure HB is updated. Open up terminal for the following steps.

$ brew update
@Ryonez
Ryonez / (Unofficial) Discord server rules suggestions list.md
Last active March 25, 2024 12:47
(Unofficial) Discord server rules suggestions list

Discord

(Unofficial) Discord server rules suggestions list

Author's Note

I'll start off with letting you know this is a fork from someone else. However, for some bizarre reason, this is the one everyone finds, so I better get round to updating this. Credit to Cristiano#2233 for the original idea.

Also, I've had a lot of people saying the rules are to strict. If you pick all the rules here, you're right, it would be very strict. However the rules below are guidelines! They are there for you to pick the ones you desire, you can ignore ones you don't want. Hopefully they might help with rules you wouldn't have thought of otherwise.

@andrasguseo
andrasguseo / modify-imported-event-timezones.php
Last active November 1, 2019 21:51
Modify timezone and time when importing with EA (The Events Calendar)
<?php
/*
* Description: Modifies the timezone and the time of imported events, if the source
* feed timezone is UTC
*
* Usage: Copy the snippet into your theme's (preferably child theme's) functions.php file.
* Modify the URL and the timezone at the end of the code based on your needs
* Timzone name list: the TZ* column on this page
* https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
*
@spivurno
spivurno / gw-gravity-forms-populate-form.php
Last active November 24, 2023 05:14
Gravity Wiz // Gravity Forms // Populate Form with Entry (Optionally Update Entry on Submission)
<?php
/**
* Gravity Wiz // Gravity Forms // Populate Form with Entry (Optionally Update Entry on Submission)
*
* Pass an entry ID and populate the form automatically. No form configuration required. Optionally update the entry on
* submission.
*
* @version 1.5
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
@harisrozak
harisrozak / wc_booking_unavailable_rentals_by_date.php
Last active October 30, 2018 17:07
WooCommerce Booking, get the unavailable rentals by date
<?php
$dateTimeStart = new DateTime($timestamp_start);
$dateTimeEnd = new DateTime($timestamp_end);
$unavailable_ids = wc_booking_unavailable_rentals_by_date($dateTimeStart, $dateTimeEnd);
// get all unavailable rentals by date
function wc_booking_unavailable_rentals_by_date($dateStart, $dateEnd) {
$filtered_rentals = array();
$unavailable_ids = array();