• Resolved dem

    (@dem)


    Hi. thx for seeing this.

    I need to display posts from 2 particular categories.

    I always used this code for displaying 1 categorie:

    <?php $my_query = new WP_Query('category_name=reviews&showposts=10'); ?>
                            <?php while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>
                                 <h2><a>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>  
    
                               <?php the_excerpt(''); ?>
                               <a>" class="more">Leer más</a>                            
    
                             <?php endwhile; ?>

    Is there some way to do something like {<?php $my_query = new WP_Query('category_name=reviews, news&showposts=10'); ?> }??

    Did i explain my self? 😀

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter dem

    (@dem)

    Another idea…

    I have this code:

    <ul>
                                  <?php
    				$posts = get_posts('numberposts=10&offset=0');
    				foreach ($posts as $post) :
    			      ?>
    
    <li>
    				<p class="date"><?php the_time('d.m.Y') ?></p><a> " title="<?php the_title() ?>"><?php the_title() ?></a>
    				</li>
    			      <?php
    			      endforeach;
    			      ?>
    			</ul>

    Is there some way to display just 2 particular cateogires? Thx.

    Thread Starter dem

    (@dem)

    Ok…

    Trying and trying i think i have a solution.

    Thx anyway for reading this. And maybe you were looking for something similar. here’s the solution:

    <ul>
                                  <?php
    				$posts = get_posts('numberposts=10&offset=0&categories=3,4');
    				foreach ($posts as $post) :
    			      ?>
    
    <li>
    				<p class="date"><?php the_time('d.m.Y') ?></p><a> " title="<?php the_title() ?>"><?php the_title() ?></a>
    				</li>
    			      <?php
    			      endforeach;
    			      ?>
    			</ul>

    See ya’.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying posts from 2 particular categories.’ is closed to new replies.