• Hi all,

    I have now this query:

    <?php query_posts('showposts=5&random=true');?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<div>
    		<h1><?php the_title(); ?></h1>
    		<p><?php postimage('thumbnail'); ?></p>
    	</div>

    It show the 5 recent post’s.

    My question:

    How to show post 5 t/m 10 (by random?)
    How to exclude a category id?

    Someone?

Viewing 6 replies - 1 through 6 (of 6 total)
  • How to show post 5 t/m 10 (by random?)

    I’m sorry, but I’m not sure what the abbreviation t/m means.

    How to exclude a category id?

    query_posts(array('category__not_in' => array(17)));
    excludes category 17

    Thread Starter blaatje123456

    (@blaatje123456)

    i mean how to show post 5 until post 10

    because i have on the frontpage post 1 until 5.

    And how to add your query into my post query?
    (this one:)

    <?php query_posts('showposts=5&random=true');?>
    how to add your array into this?

    i mean how to show post 5 until post 10

    5-10: that’s 6 posts. And to start with the 5th you need to offset by 4:

    query_posts(array(
       'showposts' => 6,
       'offset' => 4,
       'random' => true,
       'category__not_in' => array(17),
    ));
    Thread Starter blaatje123456

    (@blaatje123456)

    Thank you filosofo! You rock!

    only, one small problem, it’s not random anymore. I think it’s because the value is set by 4.
    But it must be random to (for example post 4 – 9999)

    Thread Starter blaatje123456

    (@blaatje123456)

    Hey filosofo, i got it!

    I have now created this code:

    <div id="mpu_test1">
    <?query_posts(array(
       'showposts' => 4,
       'offset' => 9,
       'random' => true,
       'category__not_in' => array(95,145,226),
    ));?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<div>
    <table width="100%" border="0">
      <tr>
        <td><img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo get_post_meta($post->ID, "image", $single = true); ?>&amp;h=57&amp;w=100&amp;zc=1&amp;q=95" alt="<?php the_title(); ?>" class="th" />			</td>
        <td><?php the_title(); ?></td>
      </tr>
    </table>
    	</div>
    <?php endwhile; else: ?><p>Oops, no posts!</p><?php endif; ?>

    but that gives this output:
    (see screenshot)
    https://i44.tinypic.com/20fxrn6.jpg

    How to make the results right under each other?
    Instant of this?:

    – item
    – item
    – item
    – item

    Thread Starter blaatje123456

    (@blaatje123456)

    other people maby?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Show Snippet’ is closed to new replies.