Skip to content

Instantly share code, notes, and snippets.

César Ribeiro chrdesigner

Block or report user

Report or block chrdesigner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chrdesigner
chrdesigner / functions.php
Created Aug 27, 2014
Custom Add To Cart Messages
View functions.php
<?php
add_filter( 'wc_add_to_cart_message', 'custom_add_to_cart_message' );
function custom_add_to_cart_message( $product_id ) {
$product_id = $_REQUEST[ 'product_id' ];
if ( is_array( $product_id ) ) {
$titles = array();
@chrdesigner
chrdesigner / filter-external.js
Created Sep 17, 2018
Sub Menu + Filter TAG ~ External
View filter-external.js
$('.filterBlog a').on('click', function(e) {
filterBlogHash(this.hash, e);
});
$(window).on('load',function() {
filterBlogHash(window.location.hash);
});
function filterBlogHash(hash, e) {
if(hash === '') {
@chrdesigner
chrdesigner / filter.js
Created Sep 17, 2018
Sub Menu + Filter TAG ~ Simple
View filter.js
$('.filterBlog').on('click', 'a', function(e){
e.preventDefault();
var hash = $(this).attr('href').replace(/^.*?(#|$)/,'');
$('.filter a.type').each(function (index, value) {
// console.log('filter' + index + ':' + $(this).attr('id'));
@chrdesigner
chrdesigner / functions.php
Last active Jul 30, 2018
Vender Somente para Estado Específico - WooCommerce
View functions.php
<?php
/**
* Brazillian states
* Function - Vender Somente para Estados Específicos - WooCommerce
*/
function wc_especifico_estado( $states ) {
$states['BR'] = array(
'SP' => __( 'S&atilde;o Paulo', 'woocommerce' ),
'RJ' => __( 'Rio de Janeiro', 'woocommerce' ),
);
@chrdesigner
chrdesigner / functions.php
Last active Nov 9, 2017
Function to create a custom related post list by tag and category
View functions.php
<?php
/**
* Related Posts.
*
* Usage:
* To show related by categories:
* Add in single.php <?php chr_related_posts(); ?>
* To show related by tags:
* Add in single.php <?php chr_related_posts( 'tag' ); ?>
*
@chrdesigner
chrdesigner / functions.php
Last active Nov 3, 2017
Display Groups of Custom Posts by their Custom Taxonomy Term
View functions.php
<?php
$post_type = 'post';
// Get all the taxonomies for this post type
$taxonomies = get_object_taxonomies( (object) array( 'post_type' => $post_type ) );
foreach( $taxonomies as $taxonomy ) :
// Gets every "category" (term) in this taxonomy to get the respective posts
$terms = get_terms( $taxonomy,
@chrdesigner
chrdesigner / main.js
Last active Sep 14, 2017
Máscara em jQuery para o oite e nove dígitos
View main.js
// <![CDATA[
jQuery(function($) {
$.mask.definitions['~']='[+-]';
//Inicio Mascara Telefone
$('input[type=tel]').focusout(function(){
var phone, element;
element = $(this);
element.unmask();
phone = element.val().replace(/\D/g, '');
if(phone.length > 10) {
@chrdesigner
chrdesigner / 00-README.md
Last active Jun 14, 2017
Git List - Post views Count
@chrdesigner
chrdesigner / 00-README.md
Created Feb 16, 2017
Git List - Exibir ou Ocultar a sua senha com jQuery
View 00-README.md
@chrdesigner
chrdesigner / 00-README.md
Last active Nov 4, 2016
Git List - Executar um vídeo a partir de um click na thumbnail
View 00-README.md
You can’t perform that action at this time.