← WordPress

Alterar tema

Lida 1449 vezes

Offline

custodio 
Membro
Mensagens 421 Gostos 6
Feedback +8

Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 100 Posts

Olá

Estou a alterar um tema Wordpress para o adaptar o melhor que possa ao site em questão.
Tem corrido bem mas há uma coisa que gostaria de fazer e que nem sequer sei se é possível.
O tema tem um widget na barra lateral com 3 tabs "Populares" "Recentes" e "Comentários". Este widget vem de um ficheiro chamado tabs.php.
É possível alterar o conteúdo das 3 tabs por posts de determinadas categorias? Mostrar os 5 últimos posts de 3 categorias concretas.

Deixo o código do ficheiro em questão (é um pouco longo, peço desculpa) para ver se alguém me consegue dar uma ajudinha nisto.

Obrigado.

Código: [Seleccione]
<div class="clear"></div>
<div id="newtabs" class="tabox ">
    <ul class="tabsnav">
        <li class="fea"><a href="#popular"> +Lidos </a></li>
<li class="rec"><a href=" #recent"> Novos  </a></li>
<li class="pop"><a href="#comy"> Comentários </a></li>
    </ul>
           
<div id="popular" class="tabsdiv">
<?php 
$my_query = new WP_Query('orderby=comment_count&showposts=5');
while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate $post->ID;
?>

<div class="fblock">
<?php boxim() ?>

<h3><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php echo substr($post->post_title,0,20); ?></a></h3>
<p>  <?php the_content_rss(''TRUE''10); ?> </p>

</div>
<?php endwhile; ?>
</div>

<div id="recent" class="tabsdiv">

<?php 
$my_query = new WP_Query('showposts=5');
while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate $post->ID;
?>

<div class="fblock">
<?php boxim() ?>

<h3><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php echo substr($post->post_title,0,20); ?></a></h3>
<p>  <?php the_content_rss(''TRUE''10); ?> </p>

</div>
<?php endwhile; ?>

</div>

 <div id="comy" class="tabsdiv">
<?php
$comments 
get_comments('status=approve&number=5');

if (
$comments) {
    echo 
'<ul>';

    foreach (
$comments as $comment) {
        echo 
'<li class="comlist"><a href="'get_permalink($comment->comment_post_ID).'#comment-'.$comment->comment_ID .'" title="'.$comment->comment_author .' | '.get_the_title($comment->comment_post_ID).'">' get_avatar$comment->comment_author_email60);
        echo 
'<span class="recent_comment_name">' $comment->comment_author ': </span>';
$comment_string $comment->comment_content;
$comment_excerpt substr($comment_string,0,80);

echo $comment_excerpt;

if (strlen($comment_excerpt) > 79){
echo ' ...';
}
        echo 
'</a></li>';
    }
    echo 
'</ul>';
}

?>

</div>
</div>