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
$(document).on('scroll', function () { | |
var altura = pageYOffset; | |
if (altura > 200) { | |
// Macumba pra quando rolar e passar dos 200px do topo | |
} else { | |
// Macumba pra quando rolar e ainda não passar dos 200px do topo | |
} | |
}); |
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
// Modifica as Páginas do Menu | |
function meu_plugin_menu_pages() { | |
if (!is_super_admin()) { | |
remove_menu_page('index.php'); | |
remove_menu_page('edit.php'); | |
remove_menu_page('upload.php'); | |
remove_menu_page('edit.php?post_type=page'); | |
remove_menu_page('edit-comments.php'); | |
remove_menu_page('themes.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
$.fn.scroller = function(offsetTop) { | |
if (offsetTop == null) { | |
offsetTop = 0; | |
} | |
this.each( function() { | |
var id = this.id; | |
$("a[href=#" + id + "]").on('click', function(event) { | |
event.preventDefault(); |
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 change_post_type_slug() { | |
$post_type_portfolio_object = get_post_type_object( 'portfolio' ); | |
$post_type_portfolio_object->rewrite['slug'] = 'produto'; | |
register_post_type( $post_type_object->name, $post_type_object ); | |
} | |
add_action( 'init', 'change_post_type_slug', 20 ); |
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 validateCPF(number) { | |
var cpf = number.toString().replace(/[^0-9]/g, ''); | |
if (cpf.length != 11) { | |
return false; | |
} | |
var digitoTestado = cpf.slice(9, 11); | |
var digitoValidado = ''; | |
var sum1 = sum2 = dig1 = dig2 = 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
<?php | |
/** | |
* Função que checa se um CPF é válido | |
* Criado em fevereiro/2016 | |
*/ | |
function check_cpf_is_valid( $string ) { | |
$cpf = pm_sanitize_number($string); |
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 | |
/** | |
* ContentFactory | |
* Classe responsável pela criação de conteúdo personalizado | |
* | |
* @author Mário Valney <[email protected]>. | |
*/ | |
if (!defined( 'ABSPATH' )) { |
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 putDots(num) { | |
if (num == 0) { | |
return "0" | |
} else { | |
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."); | |
} | |
} | |
function putDotsToMoney(num) { | |
num = parseFloat(num); |
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 | |
/** | |
* Adiciona as taxas ao subtotal no carrinho | |
*/ | |
function vta_cart_item_subtotal( $wc, $cart_item, $cart_item_key ) { | |
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); | |
$subtotal = wc_get_price_including_tax( $_product, array( 'qty' => $cart_item['quantity'] ) ); |
OlderNewer