This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// However you get a product reference | |
global $post; | |
$product = wc_get_product($post); | |
if($product && $product->get_meta('WooCommerceEventsEvent')) { | |
// it's a FooEvents product | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Minor tweaks from https://eplt.medium.com/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1 | |
sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list | |
apt-get update | |
apt-get -y install build-essential autoconf libtool git-core | |
apt-get -y build-dep imagemagick libmagickcore-dev libde265 libheif | |
cd /usr/src/ | |
git clone https://github.com/strukturag/libde265.git | |
git clone https://github.com/strukturag/libheif.git | |
cd libde265/ | |
./autogen.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Registers the `dog` post type. | |
*/ | |
function dog_init() { | |
register_post_type( 'dog', array( | |
'labels' => array( | |
'name' => __( 'Dogs', 'YOUR-TEXTDOMAIN' ), | |
'singular_name' => __( 'Dog', 'YOUR-TEXTDOMAIN' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Author: Mike Rushton | |
# | |
# IMPORTANT | |
# | |
# Please set jail.local's permission to 640 because it contains your CF API key. | |
# | |
# This action depends on curl (and optionally jq). | |
# Referenced from http://www.normyee.net/blog/2012/02/02/adding-cloudflare-support-to-fail2ban by NORM YEE | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// From https://gist.github.com/cliffordp/ab1f7c4d95723ee6f892/, a fork of https://gist.github.com/jesseeproductions/2b1af6527b7029eaea6e | |
// References: | |
// https://theeventscalendar.com/support/forums/topic/ical-only-pushing-1-month-at-a-time/ | |
// https://theeventscalendar.com/support/forums/topic/how-users-can-subscribe-to-my-events-calendar-in-their-personal-calendars/#post-1022932 | |
// https://tribe.uservoice.com/forums/195723-feature-ideas/suggestions/3777092-subscribe-to-calendar-via-ical | |
/* | |
* The Events Calendar Get Events for 1 Year from Today in iCal Export File | |
* add coding to child theme's functions.php | |
* Tested works with The Events Calendar v3.12 and v4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$event_id = tribe_create_event( [ | |
'post_title' => 'My Event', | |
// see https://docs.theeventscalendar.com/reference/functions/tribe_create_event/ for full arguments | |
] ); | |
$provider = \Tribe__Tickets__Tickets::get_event_ticket_provider(); | |
$ticket_id = $provider::get_instance()->ticket_add( $event_id, [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
public function __construct() { | |
// ... | |
add_filter( 'wp_check_filetype_and_ext', array( $this, 'update_mime_types' ), 10, 3 ); | |
add_filter( 'upload_mimes', array( $this, 'add_fonts_to_allowed_mimes' ) ); | |
} | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Usage: | |
* | |
* class RelatedHooks extends Hooks { | |
* | |
* private $actions = []; | |
* private $filters = []; | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Glob all our JSON facets and register them | |
* with FacetWP | |
*/ | |
function my_register_facets( $facets ) { | |
$new_facets_raw = glob(dirname(__FILE__) . '/facets/*.json'); // Or however you want to get your facet definitions | |
$new_facets = []; | |
foreach($new_facets_raw as $facet) { | |
$facet = json_decode(file_get_contents($facet), true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PHP_MSSQL_DRIVERS=Ubuntu18-7.3 | |
PHP_MSSQL_RELEASE=5.6.1 | |
# Download and extract phpmysql drivers | |
sudo wget "https://github.com/Microsoft/msphpsql/releases/download/v${PHP_MSSQL_RELEASE}/${PHP_MSSQL_DRIVERS}.tar" -O - | tar -x | |
# Change Directory | |
cd $PHP_MSSQL_DRIVERS |
NewerOlder