Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter zachmattheus

    (@zachmattheus)

    Sorry I’m not very good with code… you mean here?

    <?php
          $args = array(
                       'category_name' => 'featured small',
                       'post_type' => 'post',
                       'posts_per_page' => 30,
                       'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),
                       );
          query_posts($args);
          $x = 0;
          while (have_posts()) : the_post(); ?>
    
            <?php if($x == 0) { ?>
            <div class="featured_box first">
            <?php } elseif($x == 2) { ?>
            <div class="featured_box last">
            <?php } else { ?>
            <div class="featured_box">
            <?php } ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button.]

    Well that’s a custom query, yes but it’s not going to create a random order.

    Thread Starter zachmattheus

    (@zachmattheus)

    Ahhh, that’s the code I’m using at the moment provided by the theme

    In that case, try replacing the query parameters with:

    $args = array(
    	'category_name' => 'featured small',
    	'post_type' => 'post',
    	'posts_per_page' => 30,
    	'orderby' => 'rand',
    	'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),
    	);

    Thread Starter zachmattheus

    (@zachmattheus)

    Tried but nope.

    <?php
          $args = array(
                       'category_name' => 'featured small',
                       'post_type' => 'post',
                       'posts_per_page' => 30,
                       'orderby' => 'rand',
                       'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),
                       );
          query_posts($args);
          $x = 0;
          while (have_posts()) : the_post(); ?>
    
            <?php if($x == 0) { ?>
            <div class="featured_box first">
            <?php } elseif($x == 2) { ?>
            <div class="featured_box last">
            <?php } else { ?>
            <div class="featured_box">
            <?php } ?>

    That should work but right now, it seems your site is down.

    Thread Starter zachmattheus

    (@zachmattheus)

    It was that code that did that. Fixed by deleting orderby' => 'rand',

    Thread Starter zachmattheus

    (@zachmattheus)

    all fixed!

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Posts in Random Order’ is closed to new replies.