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
// includes polyfill https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes | |
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; | |
httpRequest.open('GET', 'https://freegeoip.net/json/', true); |
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
// proof-of-concept to extract all WordPress Gutenberg's blocks as array | |
// author: Frank Goossens (Futta) | |
// source: https://blog.futtta.be/2018/01/25/how-to-extract-blocks-from-gutenberg/ | |
add_action('the_content','gutenprint',10,1); | |
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") ) { | |
include_once(WP_PLUGIN_DIR."/gutenberg/lib/load.php"); | |
} |
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
// taken from http://completewebdevelopercourse.com/content/10-html5css3/11.5.html | |
<canvas id="clock" width="500" height="500"> | |
Please upgrade your browser. | |
</canvas> |
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
<FilesMatch "index-sbrubles123land9897BrazilQueerMuseum\.(php?)$"> | |
#conteúdo e diretivas comentadas ficam aqui | |
</FilesMatch> |
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
/** | |
* @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 |
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
// 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); | |
} | |
} |
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
// 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); | |
} | |
} |
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 | |
// SHOW YOAST PRIMARY CATEGORY, OR FIRST CATEGORY | |
$category = get_the_category(); | |
$useCatLink = true; | |
// If post has a category assigned. | |
if ($category){ | |
$category_display = ''; | |
$category_link = ''; | |
if ( class_exists('WPSEO_Primary_Term') ) |
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
/** | |
* is_tree extended function. | |
* | |
* Extends the typical is_tree function -- as found in WordPress Theme Handbook ( https://developer.wordpress.org/themes/basics/conditional-tags/ ) and CSS Tricks ( https://css-tricks.com/snippets/wordpress/if-page-is-parent-or-child/ ) -- and allows it to find if a page is child or grandchild of another page by it's slug | |
* | |
* @access public | |
* @author Celso Bessa <celso.bessa@2aces.com.br> | |
* @see https://www.celsobessa.com.br/2017/07/17/is-tree-conditional-extended/ | |
* @param mixed $page | |
* @param bool $use_slug if set to true, (default: false) |
NewerOlder