Forums › Forums › Search & Filter Pro › Default Sort Order – Random Order
- This topic has 8 replies, 2 voices, and was last updated 8 years, 10 months ago by Ross.
-
Anonymous(Private) December 9, 2015 at 3:30 pm #31828
Hi,
The random order for sort under the post tab doesn’t work. I found this previous topic https://support.searchandfilter.com/forums/topic/random-is-not-random/#post-9258, which says there is a bug in it but it was from Jan 2015. If its not fixed could you give me some quick pointers on how to implent the workaround mentioned in that topic. I can get around my ftp alright and i have a child theme. Any help would be greatly appreciated, Thanks
GregRoss Moderator(Private) December 9, 2015 at 6:47 pm #31844Hi gregory
I thought this had been fixed – I’ll have to look into it again and double check – but I’m pretty sure it was!
Thanks
Anonymous(Private) December 12, 2015 at 4:17 am #32053Hey Ross,
Just wondering what the status on this is? I m pretty sure it is still broken, I did all the things in the topic that I linked to, and all the other ways of sorting work. As well, the problem is exactly the same as she described. Random lists my results in reverse chronological order regardless of if I put ascending or descending.
Thanks
GregRoss Moderator(Private) December 14, 2015 at 9:15 am #32137I’m working on an update for later today – I’ll take a look just before I package it up.
Thanks
Ross Moderator(Private) December 22, 2015 at 8:20 pm #32737I’m afraid I still ahven’t had a chance to look at this.
Thanks
Ross Moderator(Private) December 31, 2015 at 12:20 am #33072Hey Gregory
I just tested locally and all seems to be working fine.
It sounds like to me that you have something that modifies the query – and in effect – modifies the sort order – something like a greedy
pre_get_posts
or something similar.Do any of the other sort methods work for you?
Support is now closed for a few days so I’m emailing you the latest dev version – that I have tested if you are eager to see if its a problem with your version of S&F or not.
Just make sure to make a backup of your current version of S&F in case you need to roll back.
Thanks
Anonymous(Private) January 8, 2016 at 3:07 am #33640Hey Ross
I uploaded that Dev version and it does fix my other problem or the search going all wonky due to plus signs, so thanks for that! However, it does not do anything for the random results order. I don’t have any pre-get-posts and the other sort orders work perfectly. The random one now just does it in order of date.This is my current result.php, could you take a quick look to see if it would effect the random order?
if ( $query->have_posts() )
{
?><div class=”pagination”>
Found <?php echo $query->found_posts; ?> Results
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists(‘wp_pagenavi’))
{
echo “<br />”;
wp_pagenavi( array( ‘query’ => $query ) );
}
?>
</div><?php $i = 0; ?>
<?php
while ($query->have_posts())
{
$query->the_post();?>
<?php
if($i == 0) {
echo ‘<div class=”ng-row”>’;
}
?><div class=”half_bbm”>
<div id=”myfirstid”><h3>“><?php the_title(); ?></h3>
“><?php
if ( has_post_thumbnail() ) {
echo ‘<p>’;
the_post_thumbnail(“small”);
echo ‘</p>’;
}
?>
<p><?php the_excerpt(); ?><br /><p></div>
</div><?php
$i++;
if($i == 3) {
$i = 0;
echo ‘</div>’;
}
?><?php
}
?><?php
if($i > 0) {
echo ‘</div>’;
}
?><div class=”pagination”>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists(‘wp_pagenavi’))
{
echo “<br />”;
wp_pagenavi( array( ‘query’ => $query ) );
}
?>
</div>
<?php
}
else
{
echo “No Results Found”;
}
?>Thanks for you time. Also, I am liking the new version, especially the automatic retrieval of new custom fields! Two things I noticed. At first I got a weird Choose an Option title appearing underneath all of the titles for my filters but that went away after a few minutes which was weird. Also you may want to give a bit more information about what the secondary sort is because i have no idea what that would do. Anyway, nice work, and i really hope you can help me figure out this random sort thing because it is pretty important for my site.
Thanks again
GregRoss Moderator(Private) January 8, 2016 at 5:50 pm #33703Hi Gregory
As I mentioned, the random order is working absolutely fine for me in all my tests – and now I’ve also tested on a few themes.
This must mean something in your environment is messing with the query stopping the random order from kicking in.
There is not much more we can try except to disable all your plugins, and test with another theme.
Please try these and let me know the results.
Thanks
-
AuthorPosts