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
// LOAD PRETTY PHOTO for the whole site | |
add_action( 'wp_enqueue_scripts', 'frontend_scripts_include_lightbox' ); | |
function frontend_scripts_include_lightbox() { | |
global $woocommerce; | |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
wp_enqueue_script( 'prettyPhoto', $woocommerce->plugin_url() . '/assets/js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array( 'jquery' ), $woocommerce->version, true ); | |
wp_enqueue_script( 'prettyPhoto-init', $woocommerce->plugin_url() . '/assets/js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array( 'jquery' ), $woocommerce->version, 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
add_action( 'wpcf7_submit', function( $contact_form, $result ) { | |
if ( empty( $result['status'] ) || 'mail_sent' != $result['status'] ) { | |
return; | |
} | |
$submission = WPCF7_Submission::get_instance(); | |
if ( ! $submission || ! $posted_data = $submission->get_posted_data() ) { | |
return; | |
} |
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
<section id="events"> | |
<h2 class="h1">Eventos</h2> | |
<?php | |
$args = array( | |
'category_name' => 'eventos', | |
'meta_key' => '_event_date', | |
'meta_query' => array( | |
array( | |
'compare' => '>=', | |
'key' => '_event_date', |
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
//Fix Contact Form 7 Submit Button | |
remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_submit', 20 ); | |
add_action( 'wpcf7_init', 'wpcf7_add_shortcode_submit_button' ); | |
function wpcf7_add_shortcode_submit_button() { | |
wpcf7_add_shortcode( 'submit', 'wpcf7_submit_button_shortcode_handler' ); | |
} | |
function wpcf7_submit_button_shortcode_handler( $tag ) { | |
$tag = new WPCF7_Shortcode( $tag ); |
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
$address = sprintf( '%s,%s,%s,%s', $_POST['rua'], $_POST['bairro'], $_POST['cidade'], $_POST['estado'] ); | |
$url = sprintf( 'http://maps.google.com/maps/api/geocode/json?address=%s&sensor=false®ion=Brazil', urlencode( $address ) ); | |
$response = wp_remote_get( $url ); | |
if ( ! is_wp_error( $response ) ) { | |
$api_response = json_decode( wp_remote_retrieve_body( $response ), true ); | |
update_post_meta( $post_id, 'lat', $api_response['results'][0]['geometry']['location']['lat'] ); | |
update_post_meta( $post_id, 'lng', $api_response['results'][0]['geometry']['location']['lng'] ); | |
} |
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
jQuery.extend(jQuery.validator.messages, { | |
required: "This field is required.", | |
remote: "Please fix this field.", | |
email: "Please enter a valid email address.", | |
url: "Please enter a valid URL.", | |
date: "Please enter a valid date.", | |
dateISO: "Please enter a valid date (ISO).", | |
number: "Please enter a valid number.", | |
digits: "Please enter only digits.", | |
creditcard: "Please enter a valid credit card number.", |
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 | |
$tabela = array( | |
'calcio' => 'Cálcio (min./máx.)', | |
'fosforo' => 'Fósforo (min.)', | |
'enxofre' => 'Enxofre (min.)', | |
'sodio' => 'Sódio (min.)', | |
'cobalto' => 'Cobalto (min.)', | |
'cobre' => 'Cobre (min.)', | |
'iodo' => 'Iodo (min.)', | |
'selenio' => 'Selênio (min.)', |
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
<section id="products"> | |
<ul class="product-areas"> | |
<?php | |
$areas_hierarchy = array(); | |
$product_areas = get_terms( 'product_area' ); | |
foreach( $product_areas as $key => $terms ) { | |
if( $terms->parent == 0 ) | |
$areas_hierarchy[$terms->term_id]['current'] = $key; | |
else | |
$areas_hierarchy[$terms->parent]['child'][$terms->term_id] = $key; |
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
// Adiciona uma imagem padrão ao the_post_thumbnail | |
function add_default_image_to_the_post_thumbnail( $html, $post_id, $post_thumbnail_id, $size, $attr ) { | |
global $_wp_additional_image_sizes; | |
if( ! $post_thumbnail_id ) { | |
if( is_array( $_wp_additional_image_sizes[$size] ) ) { | |
$sizes['width'] = $_wp_additional_image_sizes[$size]['width']; | |
$sizes['height'] = $_wp_additional_image_sizes[$size]['height']; | |
} else { | |
$sizes['width'] = get_option( $size . '_size_w' ); |
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
// Add Shortcode | |
function shortcode_grid( $atts , $content = null ) { | |
$atts = shortcode_atts( array( | |
'open' => false, | |
'close' => false, | |
'cols' => '', | |
'offset' => '', | |
'class' => '' | |
), $atts ); |