Skip to content

Instantly share code, notes, and snippets.

View walterjaworski's full-sized avatar
🏠
Working from home

Walter Jaworski walterjaworski

🏠
Working from home
View GitHub Profile
@walterjaworski
walterjaworski / gist:db8075608bbed22d06f6
Created June 9, 2014 19:29
Puxando as taxonomias de um custom post type
<?php
/*
* "tipos", "pragas" e "culturas" são taxonomias vinculadas ao custom post type
* http://codex.wordpress.org/Function_Reference/get_the_term_list
*/
echo '<h2>Tipo</h2>';
echo get_the_term_list( $post->ID, 'tipos', '', ', ', '' );
echo '<h2>Para controle de</h2>';
echo get_the_term_list( $post->ID, 'pragas', '', ', ', '' );
echo '<h2>Utilizado em</h2>';
@walterjaworski
walterjaworski / extrai
Last active February 18, 2018 22:07
Extraindo informações de um metabox do tipo Date do html5
<?php
$meta = get_post_meta( $post->ID,'data-full', true );
$dia_semana = date_i18n('l', strtotime($meta));
$dia_mes = date_i18n('d', strtotime($meta));
?>
<?php
global $wp_query;
$wp_query = new WP_Query(
array(
'post_type' => 'event',
'order' => 'ASC',
'orderby' => array( 'meta_value_num' => 'ASC', 'title' => 'ASC' ),
'meta_key' => 'data_evento',
'posts_per_page' => 6 ));
if($wp_query->have_posts()): ?>
@walterjaworski
walterjaworski / functions
Last active August 29, 2015 14:15
Custom column in post type Servicos - Correct
<?php
/* Coluna Serviços */
function servicos_manage_edit_columns( $columns ) {
$servicos_columns = array(
"cb" => $columns["cb"],
"title" => $columns["title"],
"inicial" => 'Página Inicial',
"date" => $columns["date"],
);
@walterjaworski
walterjaworski / page-palestras
Created January 11, 2016 18:06
Checkboxes com palestras e origem selecionada automaticamente
<fieldset>
<legend>Todas as palestras</legend>
<?php // WP_Query arguments
$args = array (
'post_type' => array( 'palestra' ),
);
// The Query
@walterjaworski
walterjaworski / functions.php
Created March 10, 2016 17:37
Pre_get_posts
function preget_home( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$metaquery = array(
array(
'key' => 'select_destaque',
'value' => array('maior','menor'),
'compare' => 'NOT IN'
),
array(
'key' => 'select_destaque_sidebar',
@walterjaworski
walterjaworski / calculafrete.html
Last active September 30, 2016 20:35
Calcula frete grátis
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
<p>
<label for="">Total</label> <input type="text" id="subtotal2" value="R$350,00">
<?php if (is_singular('moda') || is_archive('moda')) {
$terms = get_the_terms( $post->ID, 'categoria-moda' );
foreach($terms as $term) {
echo '<a href="' . $term->link . '" alt="' . $term->name . '">';
echo $term->name;
echo '</a>';
}
} ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>News Blog</title>
</head>
<body>
<table align="center" width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="600"><a href="http://www.seusite.com" title="Titulo do link quando mouse over"><img src="endereco-da-imagem.jpg" alt="Foto Destaque" width="600" height="altura_da_imagem_sem_px" style="display: block" /></a></td>
<script>
$(document).ajaxComplete(function( event, xhr, settings ) {
if(settings.url.indexOf('/Pedido/CalcularFretePorId') >-1) {
// Verifica se a opção "Frete Normal", do Pick-Up Store está selecionado
if($("input#tipoFreteNormal:checked").length > 0) {
//console.log('Frete Normal Checado');
$('input#tipoFreteNormal').parent('span.fbits-opcoes-frete').addClass('selecionado');
$('input#tipoFreteRetirarNaLoja').parent('span.fbits-opcoes-frete').removeClass('selecionado');
$('div#opcoesFreteNormal').removeAttr('style').css('display','block');
$('div#opcoesFreteRetirarNaLoja').removeAttr('style').css('display','none');