opala
Respostas no Fórum
-
Fórum: Plugins
Em resposta a: Listar posts relacionados e agrupados por tagsOlá, Ricardo, tudo bem?
Infelizmente sou muito novo no PHP e no WP… não consegui fazer com sua dica.
Por favor, veja meu código abaixo com sua dica. Está funcionando da mesma forma que meu código antigo… Tentei adicionar as tags dentro do array “$usadas” e não funcionou também…Obrigado pela paciência e ajuda!!
<?php query_posts('cat=13&tag=copos,jarras'); while (have_posts()) : the_post(); $usadas = array(); $posttags = get_the_tags(); foreach($posttags as $tag) { if(!in_array($tag->name, $usadas)) { echo $tag->name . ' '; $usadas[] = $tag->name; } } ?> <h3><?php the_title(); ?></h3> <?php endwhile; wp_reset_query(); wp_reset_postdata(); ?>
Fórum: Plugins
Em resposta a: Posts Relacionados por categoria e subcategoriacódigo determinando a categoria mas relacionando pela tag:
<?php
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
}
}$args = array(‘category_name’ => ‘copos’, ‘tag’ => $tag->name);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) :
$the_query->the_post();
echo ‘<div>post->ID).'”/>’ . get_the_title() . ‘</div>’;
endwhile;
wp_reset_postdata();
?>Fórum: Plugins
Em resposta a: Posts Relacionados por categoria e subcategoriafuncionou com o código abaixo:
<?php
$categoria = get_the_category($post->id);
$nomeCategoria = $categoria[0]->term_id;$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
}
}$args = array(‘cat’ => $nomeCategoria, ‘tag’ => $tag->name);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) :
$the_query->the_post();
echo ‘<div>post->ID).'”/>’ . get_the_title() . ‘</div>’;
endwhile;
?>Fórum: Plugins
Em resposta a: Posts Relacionados por categoria e subcategoriaEstou chegando perto do que preciso com o código abaixo.
Em vez categoria e subcategoria, estou fazendo com categoria e tag.
Porém, não consegui fazer o filtro por categoria e tag.. no código abaixo só funciona as categorias… como faço para pegar, também, as tags??? Obrigado!<?php
global $post;
$categoria = get_the_category($post->id);
$nomeCategoria = $categoria[0]->cat_name;$posttags = get_the_tags($post->id);
$nomeTag = $posttags->name;query_posts(array(‘category_name’ => $nomeCategoria, $nomeTag => $post->post_name, ‘showpost’ => 5));
;?><?php while (have_posts()) : the_post();?>
<?php endwhile;?>
<?php wp_reset_query(); ?>Fórum: Plugins
Em resposta a: Abrir links em nova aba ??olá, tdo bem?
Não sei se entendi.. mas não é o caso de add “target=”_blank”” no <ahref..> dos downloads?
absFórum: Plugins
Em resposta a: Posts Relacionados por categoria e subcategoriaOBS importante: não posso eliminar a categoria pai (COPOS) e tornar as filhas (vidro, cristal e plastico) como pai.