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
/** | |
* Enable Gutenberg support for WooCommerce Products | |
* @link https://github.com/woocommerce/woocommerce/issues/28419#issuecomment-945430144 | |
*/ | |
add_filter( 'use_block_editor_for_post_type', function ( $can_edit, $post_type ) { | |
if ( $post_type == 'product' ) { | |
$can_edit = 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
<?php | |
// Remover tags style do HTML. | |
$dom = new DOMDocument(); | |
$dom->preserveWhiteSpace = false; | |
$dom->loadHTML( $content ); | |
$styles = $dom->getElementsByTagName( 'style' ); | |
while( $styles->length > 0 ) { | |
$style = $styles->item(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
// Validação dos campos para Javascript personalizado. | |
jQuery( '.epc-custom-js textarea' ).on( 'input change propertychange', function() { | |
var pattern = jQuery( this ).attr( 'pattern' ); | |
// Define o padrão da expressão regular. | |
if ( typeof pattern !== typeof undefined && pattern !== false ) { | |
var patternRegex = new RegExp('^' + pattern.replace(/^\^|\$$/g, '') + '$', 'gm' ); | |
hasError = ! jQuery( this ).val().match( patternRegex ); | |
// Só apresenta a mensagem se o campo não estiver vazio. |
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
#!/bin/bash | |
rm -f -- "$CK_PROJECT_ROOT/theme.json" && cat "$CK_PROJECT_ROOT/src/json/"*.txt >> "$CK_PROJECT_ROOT/theme.json" |
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
(function ($) { | |
"use strict"; | |
$(function () { | |
$( 'a.tag-cloud-link' ).each(function( index ) { | |
var index = Math.round( Math.random() * 1 ); | |
$( this ).eq( index ).hide(); | |
}); | |
}); | |
}(jQuery)); |
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
REM This file converts all of the Markdown files to HTML. | |
REM Converting in the current directory | |
REM %%~ni returns just the filename of %%i, not its extension | |
for %%i in (*.markdown) do pandoc -f markdown -t html5 %%~ni.markdown > html/%%~ni.html | |
REM Converting a subdirectory - just slap it on front | |
for %%i in (report_pages/*.markdown) do pandoc -f markdown -t html5 report_pages/%%~ni.markdown > html/report_pages/%%~ni.html |
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
:: This batch file converts HTML files in a folder to docx. | |
:: It requires Pandoc, and a list of files to convert | |
:: named file-list, in which each file is on a separate line, | |
:: and contains no spaces in the filename. | |
:: | |
:: Don't show these commands to the user | |
@ECHO off | |
:: Set the title of the window | |
TITLE Convert html to docx | |
:: This thing that's necessary. |
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
#!/bin/bash | |
# Converts HTML from https://exportmyposts.jazzychad.net/ exports to Markdown | |
POSTS_DIR=/Users/richard/Desktop/d6y/posts | |
for file in $POSTS_DIR/*.html | |
do | |
echo $file |
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 | |
// A função abaixo demonstra o uso de uma expressão regular que identifica, de forma simples, telefones válidos no Brasil. | |
// Nenhum DDD iniciado por 0 é aceito, e nenhum número de telefone pode iniciar com 0 ou 1. | |
// Exemplos válidos: +55 (11) 98888-8888 / 9999-9999 / 21 98888-8888 / 5511988888888 | |
function phoneValidate($phone) | |
{ | |
$regex = '/^(?:(?:\+|00)?(55)\s?)?(?:\(?([1-9][0-9])\)?\s?)?(?:((?:9\d|[2-9])\d{3})\-?(\d{4}))$/'; | |
if (preg_match($regex, $phone) == 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
{ | |
"key": "dcwd_flip_card_group", | |
"title": "Flip Card", | |
"fields": [ | |
{ | |
"key": "front_image", | |
"label": "Front image", | |
"name": "card_front", | |
"type": "image", | |
"return_format": "array", |