Skip to content

Instantly share code, notes, and snippets.

View LiamBailey's full-sized avatar
💭
Build With Heart - Codeable.io

Liam Bailey LiamBailey

💭
Build With Heart - Codeable.io
View GitHub Profile
@LiamBailey
LiamBailey / Woocommerce Bookings Dropdown
Created March 10, 2016 18:25
Changes out the Woocommerce Bookings date picker fields for a nice dropdown showing only available dates
<?php
/*
Plugin Name: Woocommerce Bookings Dropdown
Description: Swaps the date picker for a dropdown of dates
Version: 1.0.0
Author: Webby Scots
Author URI: http://webbyscots.com/
*/
$wswp_dates_built = false;
add_filter('booking_form_fields','wswp_booking_form_fields');
@LiamBailey
LiamBailey / Strip_html
Created September 24, 2015 15:21
Strips out html (person importing content from Blogger)
<?php
$content = strip_tags($_POST['content'],"<p><br><a>");
lib_xml_use_internal_errors(true);
$DOM = new DOMDocument($content);
foreach($dom->getElementsByTagName($tagname) as $tag) {
if ($tag->hasAttributes()) {
foreach($tag->attributes as $attribute) {
if ($attribute->nodeName !== "href")
$tag->removeAttribute($attribute->nodeName);