Function e listagem de Categorias ou Taxonomy com imagens de tamanhos personalizados.
Plugin usado: http://wordpress.org/plugins/categories-images/
<?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)); |
<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 global $post; $category = get_the_category($post->ID); echo $category[0]->name; ?> |
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); } } ?> |
<?php | |
$query_args = array( | |
'post_type' => 'product', | |
'product_cat' => SLUG-YOUR-CATEGORY, | |
'post_status' => 'publish', | |
'ignore_sticky_posts' => 1, | |
'posts_per_page' => 3, | |
'meta_query' => array( | |
array( | |
'key' => '_visibility', |
<?php | |
add_filter('the_posts', 'show_future_posts'); | |
function show_future_posts($posts) | |
{ | |
global $wp_query, $wpdb; | |
if(is_single() && $wp_query->post_count == 0) | |
{ | |
$posts = $wpdb->get_results($wp_query->request); |
<?php | |
global $post; | |
$trim_length = 450; //desired length of text to display | |
$summary_excerpt = 'wpcf-breve-descricao'; | |
$value = get_post_meta($post->ID, $summary_excerpt, true); | |
if ($value != '') { | |
if(strlen($value) <= $trim_length){ | |
echo apply_filters('breve-descricao', $value); | |
} else { | |
echo apply_filters('breve-descricao', rtrim(substr($value,0,$trim_length)).'...'); |
<?php | |
function chr_redirect_post_type() { | |
global $wp_query; | |
if ( is_post_type_archive('sliders') || is_singular('sliders') ) : | |
$url = get_bloginfo('url'); | |
wp_redirect( esc_url_raw( $url ), 301 ); | |
exit(); | |
endif; | |
} | |
add_action ( 'template_redirect', 'chr_redirect_post_type', 1); |