Skip to content

Instantly share code, notes, and snippets.


2ACES 2aces

View GitHub Profile
2aces / ao-language-switcher-alt-commented.js
Last active Feb 27, 2018
Autoptimize / Optimize Matters website language switcher
View ao-language-switcher-alt-commented.js
// includes polyfill
Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(r,e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),n=t.length>>>0;if(0===n)return!1;var i,o,a=0|e,u=Math.max(a>=0?a:n-Math.abs(a),0);for(;u<n;){if((i=t[u])===(o=r)||"number"==typeof i&&"number"==typeof o&&isNaN(i)&&isNaN(o))return!0;u++}return!1}});
(function() {
var httpRequest;
var location = window.location.href;
var suffix = '';
httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = getCountry;'GET', '', true);
2aces / futta-gutenprint.php
Created Feb 6, 2018
Frank Goossens (Futta) function to extract blocks from WP Gutenberg (Proof of Concept) as
View futta-gutenprint.php
// proof-of-concept to extract all WordPress Gutenberg's blocks as array
// author: Frank Goossens (Futta)
// source:
function gutenprint($html) {
// check if we need to and can load the Gutenberg PEG parser
if ( !class_exists("Gutenberg_PEG_Parser") && file_exists(WP_PLUGIN_DIR."/gutenberg/lib/load.php") ) {
2aces / clock-with-js-canvas.html
Created Jan 21, 2018
Javascript and HTML5 Canvas clock
View clock-with-js-canvas.html
// taken from
<canvas id="clock" width="500" height="500">
Please upgrade your browser.
2aces / wp-social-buttons-cloner.php
Created Nov 8, 2017
An experiment for cloning social buttons and insert them elsewhere in a WordPress page
View wp-social-buttons-cloner.php
function wp_social_buttons_cloner_scripts() {
wp_register_script( 'wp_social_buttons_cloner', $path_to_the_javascript_script, array(''), '0.1.0', true);
wp_register_script( 'wp_social_buttons_cloner');
add_action('wp_enqueue_scripts', 'wp_social_buttons_cloner_scripts');
2aces / .htaccess-faux-comentarios-multilinhas
Last active Oct 11, 2017
Faux Multiline Comments on Apache / Faux Comentários Multilinhas no Apache. More on
View .htaccess-faux-comentarios-multilinhas
<FilesMatch "index-sbrubles123land9897BrazilQueerMuseum\.(php?)$">
#conteúdo e diretivas comentadas ficam aqui
2aces / add_noscript_filter-pt_br.php
Last active Mar 3, 2019
filters an enqueued script tag on WordPress (identified by the $handle variable) and adds a noscript element after it. If there is also an inline script enqueued after $handled, adds the noscript element after it.
View add_noscript_filter-pt_br.php
* @summary filtra uma tag de script na fila e adiciona um elemento noscript após ela
* @description filtra uma tag de script na fila (identificada pela variável $handle) e adiciona
* um elemento noscript após ela. Se também houver um script inline após o script
* identificado por $handle, adiciona o elemento noscript após ele.
* @access público
* @param string $tag A string da tag enviada pelo filtro `script_loader_tag` em WP_Scripts::do_item
* @param string $handle O nome (handle) do como enviado pelo filtro `script_loader_tag` em WP_Scripts::do_item
2aces / conditional-remove-custom-css-archive.php
Created Sep 18, 2017
WordPress: remove custom CSS created by Customizer
View conditional-remove-custom-css-archive.php
// first check if we are not in Admin area
if( !is_admin ){
// check if we are in an archive
if( is_archive() ){
//remove wp_custom_css_cb from the actions queue on wp_head using the same priority, 101
remove_action('wp_head', 'wp_custom_css_cb', 101);
2aces / conditional-remove-custom-css-archive-pt_br.php
Last active Sep 18, 2017
WordPress: removendo o CSS personalizado criado pelo Customizer
View conditional-remove-custom-css-archive-pt_br.php
// primeiro verifica se não estamos no Admin
if( !is_admin ){
// detecta se estamos num arquivo
if( is_archive() ){
//remove a função wp_custom_css_cb da lista de ações em wp_head usando a mesma prioridade 101
remove_action('wp_head', 'wp_custom_css_cb', 101);
2aces / primary_category.php
Created Sep 8, 2017 — forked from jawinn/primary_category.php
Display Primary Category (Yoast's WordPress SEO)
View primary_category.php
$category = get_the_category();
$useCatLink = true;
// If post has a category assigned.
if ($category){
$category_display = '';
$category_link = '';
if ( class_exists('WPSEO_Primary_Term') )
2aces / is_tree_extended.php
Last active Jul 17, 2017
An extended version of WordPress is_tree and is_page conditionals for finding if a page is child or grandchild of another page by it's slug
View is_tree_extended.php
* is_tree extended function.
* Extends the typical is_tree function -- as found in WordPress Theme Handbook ( ) and CSS Tricks ( ) -- and allows it to find if a page is child or grandchild of another page by it's slug
* @access public
* @author Celso Bessa <>
* @see
* @param mixed $page
* @param bool $use_slug if set to true, (default: false)