← WordPress

Pagina com diverso conteudo e conteudos de x categoria

Lida 1129 vezes

Offline

Kajolas 
Membro
Mensagens 9 Gostos 0
Troféus totais: 17
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Level 3 Level 2 Level 1 First Post Karma Nineth year Anniversary Eighth year Anniversary

Tenho o seguinte conteudo para a minha pagina author.php
Eu apenas quero imprimir os posts da categoria 3, o que devo fazer e se possivel como fazer paginação de 10 em 10 posts?

Obrigado por todas as respostas


<!-- The Loop -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  <li>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
<?php the_title(); ?></a>,
<?php the_time('d M Y'); ?> in <?php the_category('&');?>
  </li>

  <?php endwhile; else: ?>
     <p><?php _e('No posts by this author.'); ?></p>

   <?php endif; ?>
<!-- End Loop -->
</ul>
</div>

<?php get_footer(); ?>

Offline

bfms 
Equipa
Mensagens 1769 Gostos 40
Feedback +1

Troféus totais: 35
Trófeus: (Ver todos)
Search Level 6 Apple User Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

Queres fazer isso apenas para um autor, certo?

Se sim, podes fazer o seguinte:

Onde tens:
Código: [Seleccione]
<!-- The Loop -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

Substitui por:
Código: [Seleccione]
<?php
global $post;
$myposts get_posts('category=x');
foreach(
$myposts as $post) :
?>

  <li>
  <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
  <?php the_title(); ?></a>,
  <?php the_time('d M Y'); ?> in <?php the_category('&');?>
  </li>

  <?php endforeach; ?>
<!-- End Loop -->
</ul>
</div>

(onde x será o número da tua categoria (ex: 4))


Não tenho a certeza se isto funcionará pois não testei... experimenta e depois diz algo.