Change this loop to display RAND posts?
-
<?php global $data, $is_blog,$is_portfolio,$is_category,$is_search; $is_contact_page = false; $optionss =isset($post->ID)? get_post_meta($post->ID, 'themeton_additional_options', true):false; if($optionss===false){ unset($optionss);} $paged=isset($_REQUEST['infPaged'])?$_REQUEST['infPaged']:1; if($is_category===true){ $category = get_query_var('cat'); } if($is_search===true){ $search = get_query_var('s'); } //////////////////ABOUT PAGE////////////////////// if(get_ID_by_slug($data['first_page']) && ($is_portfolio===true || $is_blog===true) && !isset($_REQUEST['infPaged'])){ query_posts( 'page_id='.get_ID_by_slug($data['first_page']) ); while (have_posts ()) : the_post(); get_template_part('post'); endwhile; wp_reset_query(); } //////////////////POSTS/////////////////////////// if($is_blog===true || $is_portfolio===true){ //Blog page && Portfolio page $tt_query = ""; if(isset($optionss['posts_perpage'])){ $tt_query .= "posts_per_page=" . $optionss['posts_perpage']; } if (isset($optionss['blog_categories'])) { $includecats = implode(',', (array) $optionss['blog_categories']); $includecats = $includecats ? "&category_name='" . $includecats . "'" : ''; $tt_query .= $includecats; } $query=$tt_query; }elseif($is_category===true){ $query='cat='.$category; }elseif($is_search===true){ $query='s='.$search; }else{ $query=''; } $query.="&paged=$paged"; if(isset($query)&&$query){ query_posts( $query ); } while (have_posts ()) : the_post(); get_template_part('post'); endwhile; wp_reset_query(); //////////////////CONTACT PAGE//////////////////// if(get_ID_by_slug($data['last_page']) && ($is_portfolio===true || $is_blog===true) && !isset($_REQUEST['infPaged'])){ query_posts( 'page_id='.get_ID_by_slug($data['last_page']) ); while (have_posts ()) : the_post(); get_template_part('post'); endwhile; wp_reset_query(); } ?>What part do I have to edit to get random posts?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Change this loop to display RAND posts?’ is closed to new replies.