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
function in_array_any($needles, $haystack) { | |
return !empty(array_intersect($needles, $haystack)); | |
} |
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
function getDateTimeNow() { | |
var now = new Date(); | |
return now.getDate() + '/' + (now.getMonth()+1) + '/' + now.getFullYear() + ' - ' + now.getHours() + ':' + now.getMinutes(); | |
//returns "13/12/2019 - 11:26" | |
//NOTE: now.getMonth() is zero indexed (January is 0) so plus one to make it human friendly. | |
} |
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
/* | |
Google Analytics is required for the below to function | |
This code is ideally fired on anchor click. | |
It then passes the anchor link as well as a desired data-attribute on the anchor as the event label. | |
This has been tested with the gtag.js analytics code. | |
*/ | |
function fireGoogleEvent(event) { | |
url = $(this).attr('href'); | |
data = $(this).data('ATTRIBUTE'); | |
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 function console($arr) { | |
<script type="text/javascript"> | |
var arr = <?php echo json_encode($arr); ?>; | |
console.log(arr); | |
</script> | |
} | |
?> |
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
//Checking div for a shorcode and doing work to hide everything after it | |
//Set Some naming and labels | |
let wrapOptions = { | |
moreButtonText: 'Show More', | |
lessButtonText: 'Show Less', | |
buttonClass: 'readMoreButton', | |
wrapperClass: 'wrapAllText', | |
wrapperClosedClass: 'wrapAllText__hidden', |
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
function get_woo_variations() { | |
global $product; | |
return $product->get_available_variations(); | |
} | |
add_action( 'woocommerce_after_shop_loop_item', 'amend_add_to_cart_buttons', 1 ); | |
function amend_add_to_cart_buttons() { | |
if( is_product_category() || is_shop()) { | |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ); |
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
/** | |
* Gulpfile. | |
* | |
* Gulp with WordPress. | |
* | |
* Implements: | |
* 1. Live reloads browser with BrowserSync. | |
* 2. CSS: Sass to CSS conversion, error catching, Autoprefixing, Sourcemaps, | |
* CSS minification, and Merge Media Queries. | |
* 3. JS: Concatenates & uglifies Vendor and Custom JS files. |
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
<div id="wrapper"> | |
<h1>This is the primary heading and there should only be one of these per page</h1> | |
<p>A small paragraph to <em>emphasis</em> and show <strong>important</strong> bits.</p> | |
<ul> | |
<li>This is a list item</li> | |
<li>So is this - there could be more</li> | |
<li>Make sure to style list items to: | |
<ul> | |
<li>Not forgetting child list items</li> | |
<li>Not forgetting child list items</li> |
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
{ | |
"name": "[[ Project Name ]]", | |
"description": "A WPGulp based project.", | |
"version": "1.0.0", | |
"author": "Link Digital", | |
"repository": { | |
"type": "git", | |
"url": "[[ Git Repo ]]" | |
}, | |
"license": "MIT", |
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
/** | |
* WPGulp Configuration File | |
* | |
* 1. Edit the variables as per your project requirements. | |
* 2. In paths you can add <<glob or array of globs>>. | |
* | |
* @package WPGulp | |
*/ | |
module.exports = { |
NewerOlder