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
import { __ } from '@wordpress/i18n'; | |
__( 'Hello, Luigi!', 'woo-gutenberg-products-block' ); |
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
let url = 'https://api.wordpress.org/themes/info/1.2/?action=query_themes&request[search]=%20&request[fields][downloaded]=true&request[fields][active_installs]=true&request[per_page]=-1'; | |
let results = await fetch( url ) | |
.then( response => response.json() ) | |
.then( data => data.info.results ) | |
.catch(err => console.log( err ) ); | |
console.log(results); | |
let max = 1000; | |
let pages = Math.ceil(results / max); |
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": "niels/vip-go-site", | |
"description": "VIP Go test site of Niels Lange", | |
"repositories": [ | |
{ | |
"type": "composer", | |
"url": "https://wpackagist.org" | |
} | |
], | |
"require": { |
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
// Validate IPv4 address | |
function isValidIPv4(string) { | |
const octet = '(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?|0)'; | |
const regex = new RegExp(`^${octet}\\.${octet}\\.${octet}\\.${octet}$`); | |
return regex.test(string) ? true : false; | |
} |
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 | |
// Check enqueued scripts | |
add_action( 'wp_enqueue_scripts', 'nl_check_enqueued_scripts', 99999 ); | |
function nl_check_enqueued_scripts() { | |
global $wp_scripts; | |
var_dump( $wp_scripts ); | |
} | |
// Check enqueued styles |
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 | |
global $wpdb; | |
$wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_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
<?php | |
/** | |
* Reorder EU VAT field on checkout page | |
* | |
* @param $fields array The original array with the checkout fields | |
* @return $fields array The updated array with the checkout fields | |
* @see https://woocommerce.com/products/eu-vat-number/ | |
*/ | |
function smntcs_reorder_eu_vat_field( $fields ) { | |
$fields['billing']['billing_vat_number']['priority'] = 35; |
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 find_uniq($a) { | |
sort($a); | |
return ($a[0] === $a[1]) ? end($a) : current($a); | |
} |
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 find_uniq(array $array): int { | |
sort($array); | |
if ( $array[0] === $array[1] ) rsort($array); | |
return $array[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
# Set maximum character length of function GROUP_CONCAT() to 10000. | |
SET SESSION group_concat_max_len = 10000; |