Skip to content

Instantly share code, notes, and snippets.

View cliffordp's full-sized avatar

Clifford cliffordp

View GitHub Profile
@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)
View functions.php
<?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
View localwp-no-conflict.sh
# 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
View .gitconfig
[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).
View _wp_upload_dir-wp.php
/**
* 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
View mailhog-mamp.md

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
@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)
View modify-imported-event-timezones.php
<?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)
View gw-gravity-forms-populate-form.php
<?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
View wc_booking_unavailable_rentals_by_date.php
<?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();
@elimn
elimn / tribe_additional_feed_views.php
Last active March 23, 2017 14:54
MT | TEC | Add more display options to the ical feeds
View tribe_additional_feed_views.php
<?php
/**
* Adds more display options to the ical feeds
*
* This will show recently published events, up to 40 of them:
* events-slug/?ical=1&tribe_display=recently-published&tribe_posts_amount=40
*
* This will show all events in the year 2012
* events-slug/?ical=1&tribe_display=year&eventDate=2012
@cliffordp
cliffordp / Tribe__Snippet__Change_All_Link.php
Last active February 28, 2017 19:47 — forked from elimn/Tribe__Snippet__Change_All_Link.php
MT | TEC | Change the recurrent events see all page to a different URL
View Tribe__Snippet__Change_All_Link.php