Function e listagem de Categorias ou Taxonomy com imagens de tamanhos personalizados.
Plugin usado: http://wordpress.org/plugins/categories-images/
<?php if(get_post_custom_values('SEU-CUSTOM-FILD')) { foreach(get_post_custom_values('SEU-CUSTOM-FILD') as $suavarivel) { echo wpautop($suavarivel); } } ?> |
Function e listagem de Categorias ou Taxonomy com imagens de tamanhos personalizados.
Plugin usado: http://wordpress.org/plugins/categories-images/
<?php global $post; $category = get_the_category($post->ID); echo $category[0]->name; ?> |
<ul> | |
<?php $tags = get_the_tags(); foreach ( (array) $tags as $tag ) { echo '<li><a href="' . get_tag_link($tag->term_id) . '" title="' . $tag->name . '">' . $tag->name . '</a></li>';}?> | |
</ul> |
<ul> | |
<?php $link = get_bookmarks('category=ID-CATEGORIA&orderby=rating'); foreach ($link as $bmark) { $url = $bmark->link_url; ?> | |
<li> | |
<a href="<?php echo $bmark->link_url;?>" title="<?php echo $bmark->link_name;?>." target="<?php echo $bmark->link_target;?>"> | |
<img src="<?php echo $bmark->link_image;?>" alt="<?php echo $bmark->link_name;?>." title="<?php echo $bmark->link_name;?>." /> | |
</a> | |
</li> | |
<?php }; ?> | |
</ul> |
<?php | |
function hex2RGB($hex) { | |
$hex = str_replace("#", "", $hex); | |
if(strlen($hex) == 3) { | |
$r = hexdec(substr($hex,0,1).substr($hex,0,1)); | |
$g = hexdec(substr($hex,1,1).substr($hex,1,1)); | |
$b = hexdec(substr($hex,2,1).substr($hex,2,1)); | |
} else { | |
$r = hexdec(substr($hex,0,2)); | |
$g = hexdec(substr($hex,2,2)); |
var $window = $(window), $html = $('html'); | |
$window.resize(function resize(){ | |
if ($window.width() < 415) { | |
return $html.addClass('mobile'); | |
} | |
$html.removeClass('mobile'); | |
}).trigger('resize'); |
<?php | |
/* | |
* Function - Disable Checkout for some Countries and States | |
*/ | |
function wc_checkout_validation() { | |
$shipping_country = ! empty( $_POST['shipping_country'] ) ? $_POST['shipping_country'] : $_POST['billing_country']; | |
$shipping_state = ! empty( $_POST['shipping_state'] ) ? $_POST['shipping_state'] : $_POST['billing_state']; | |
// Add here States : More example look here -> wp-content/plugins/woocommerce/i18n/states/ |
<?php | |
/* | |
* Search in Specific Post Type | |
*/ | |
function search_specific_post_type($query) { | |
if ($query->is_search) { | |
$query->set('post_type', array('post')); | |
}; | |
return $query; | |
}; |
<?php | |
/* | |
* Add Stock Quantity in Catalog Loop | |
*/ | |
function odin_stock_catalog() { | |
global $product; | |
if ( $product->is_in_stock() ) { | |
echo '<div class="stock" >' . $product->get_stock_quantity() . __( 'EM ESTOQUE', 'odin' ) . '</div>'; | |
} else { | |
echo '<div class="out-of-stock" >' . __('SEM ESTOQUE', 'odin' ) . '</div>'; |