Paginate Pages #wordpress
<?php
$pagelist = get_pages("child_of=".$post->post_parent."&parent=".$post->post_parent."&sort_column=menu_order&sort_order=asc");
$pages = array();
foreach ($pagelist as $page) {
   $pages[] += $page->ID; 
}
$current = array_search($post->ID, $pages);
$prevID = $pages[$current-1];
$nextID = $pages[$current+1];

if (!empty($prevID) || !empty($nextID)) { ?>
<div class="navigation-wrapper">
	<div class="navigation">
		<?php if (!empty($prevID)) { ?>
		<div class="cell cell-previous">
			<a href="<?php echo get_permalink($prevID); ?>" title="<?php echo get_the_title($prevID); ?>">
				Précédent<br>
				<strong><?php echo get_the_title($prevID); ?></strong>
			</a>
		</div>
		<?php } ?>
		<?php if (!empty($nextID)) { ?>
		<div class="cell cell-next">
			<a href="<?php echo get_permalink($nextID); ?>" title="<?php echo get_the_title($nextID); ?>">
				Suivant<br>
				<strong><?php echo get_the_title($nextID); ?></strong>
			</a>
		</div>
		<?php } ?>
	</div>
</div>
Append url parameters to links with classname #Javascript
//Append url parameters to links with classname
(function() {
var domainsToDecorate = ['domain.com'], queryParams = ['utm_medium','utm_source','utm_campaign','utm_term','utm_content'];
var links = document.querySelectorAll('.rewrite-url'); 
for (var linkIndex = 0; linkIndex < links.length; linkIndex++) {
 for (var domainIndex = 0; domainIndex < domainsToDecorate.length; domainIndex++) { 
   if (links[linkIndex].href.indexOf(domainsToDecorate[domainIndex]) > -1 && links[linkIndex].href.indexOf("#") === -1) {
	 links[linkIndex].href = decorateUrl(links[linkIndex].href);
   }
 }
}
function decorateUrl(urlToDecorate) {
 urlToDecorate = (urlToDecorate.indexOf('?') === -1) ? urlToDecorate + '?' : urlToDecorate + '&';
 var collectedQueryParams = [];
 for (var queryIndex = 0; queryIndex < queryParams.length; queryIndex++) {
   if (getQueryParam(queryParams[queryIndex])) {
	 collectedQueryParams.push(queryParams[queryIndex] + '=' + getQueryParam(queryParams[queryIndex]))
   }
 }
 return urlToDecorate + collectedQueryParams.join('&');
}
function getQueryParam(name) {
 if (name = (new RegExp('[?&]' + encodeURIComponent(name) + '=([^&]*)')).exec(window.location.search))
   return decodeURIComponent(name[1]);
}
Hubspot Form Callbacks #Hubspot
// https://legacydocs.hubspot.com/global-form-events
// onBeforeFormInit - onFormReady - onFormSubmit - onFormSubmitted
window.addEventListener('message', event => {
 if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') {
  // Form Ready
 } else if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
  // Form Submit
 }
});
ipv6 to v4 #Javascript
//FUNC FROM https://jsfiddle.net/asheroto/u7hfjm9k/
function IP6to4(ip6) {
    function parseIp6(ip6str) {
        const str = ip6str.toString();

        // Initialize
        const ar = new Array();
        for (var i = 0; i < 8; i++) ar[i] = 0;

        // Check for trivial IPs
        if (str == '::') return ar;
        
        // Parse
        const sar = str.split(':');
        let slen = sar.length;
        if (slen > 8) slen = 8;
        let j = 0;
        i = 0
        for (i = 0; i < slen; i++) {
            // This is a "::", switch to end-run mode
            if (i && sar[i] == '') {
                j = 9 - slen + i;
                continue;
            }
            ar[j] = parseInt(`0x0${sar[i]}`);
            j++;
        }

        return ar;
    }

    var ip6parsed = parseIp6(ip6);
    const ip4 = `${ip6parsed[6] >> 8}.${ip6parsed[6] & 0xff}.${ip6parsed[7] >> 8}.${ip6parsed[7] & 0xff}`;
    return ip4;
}
User Creation Callback #woocommerce
// define the woocommerce_created_customer callback 
function action_woocommerce_created_customer( $customer_id, $new_customer_data, $password_generated ) { 
    // make action magic happen here... 
};
// add the action 
add_action( 'woocommerce_created_customer', 'action_woocommerce_created_customer', 10, 3 ); 

No more items to load