https://www.youtube.com/watch?v=dArgOrm98Bk
Just dump everything from mind
- Imagine 6 impossible things
- How can I make someone else happy right now?
- What's something in my immediate environment that I have never noticed?
<?php | |
/** | |
* Updates the avatar of a user based on the user's ID. | |
* | |
* This function downloads an image from an external URL and saves it | |
* as the user's avatar. If the image is not square, it crops it to a | |
* square shape before saving. | |
* | |
* @since 1.0.0 | |
* @access public |
https://www.youtube.com/watch?v=dArgOrm98Bk
Just dump everything from mind
<?php | |
/* This code goes into your child theme's function.php file | |
* Or it can use FacetWP's recommendation and use a plugin https://facetwp.com/how-to-use-hooks/ | |
* | |
* I found that the tutorial on FacetWP's site didn't function how I wanted it to. | |
* https://facetwp.com/how-to-hide-the-template-until-facets-are-selected/ | |
* Their method doesn't allow a template to show if you use a link with a url query, indicating a facet selection, it only works if | |
* if you 'click' on the page. So I came up with some JS that looks at the facet list, and looks for any 'checked' items. | |
* This way, whether it was clicked while on the page, or you linked to the page with a query string selection, it still works as I wanted. | |
*/ |
function insert_html_in_header() { | |
echo '<<< html here >>>'; | |
} | |
/* Admin Dashboard */ | |
add_action( 'admin_head', 'insert_html_in_header' ); | |
/* Front End */ | |
add_action( 'wp_head', 'insert_html_in_header' ); |
function gmailAutoarchive() { | |
var threads = GmailApp.search("in:inbox label:auto-archive older_than:2d"); | |
Logger.log("found " + threads.length + " threads:"); | |
for(var i = 0; i < threads.length; i++) { | |
var thread = threads[i]; | |
Logger.log((i+1) + ". " + thread.getFirstMessageSubject()); | |
} | |
var batch_size = 100; |
/* This script auto-generates a Google OAuth token from a Service Account key, | |
* and stores that token in accessToken variable in Postman. | |
* | |
* Prior to invoking it, please paste the contents of the key JSON | |
* into serviceAccountKey variable in a Postman environment. | |
* | |
* Then, paste the script into the "Pre-request Script" section | |
* of a Postman request or collection. | |
* | |
* The script will cache and reuse the token until it's within |
<?php | |
namespace HWID\SampleCode; | |
class GravityForms { | |
public static function init() { | |
add_filter( 'gform_custom_merge_tags', [ 'HWID\SampleCode\GravityForms', 'custom_merge_tags' ], 10, 4 ); | |
add_filter( 'gform_replace_merge_tags', [ 'HWID\SampleCode\GravityForms', 'replace_merge_tags' ], 10, 3 ); | |
} | |
/** |
<script> | |
(function($) { | |
/** | |
* check if a facet exists and has value(s), change 'categories' to name of the facet being checked | |
*/ | |
$(document).on('facetwp-loaded', function() { | |
if ('undefined' !== typeof FWP.facets['categories'] && FWP.facets['categories'].length > 0 ) { | |
// do something if facet is in use | |
} | |
}); |