Skip to content

Instantly share code, notes, and snippets.

Avatar

Clifford cliffordp

View GitHub Profile
@cliffordp
cliffordp / functions.php
Created Oct 30, 2022 — 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 Jul 20, 2022
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 Jul 29, 2020
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
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 Jan 30, 2018
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 Nov 1, 2019
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 Aug 27, 2021
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 Oct 30, 2018
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 Mar 23, 2017
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 Feb 28, 2017 — 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