Random Posts, Blog & Listings Display

  • Richard
    Richard
    Newbie
     
    51 points

    Hey Guys,

    I was wondering if there was a code to manually implement to have posts/blog & listings to be displayed in a random order? The system default places items newest first and I would like to have each refresh of page be random display of items not the same each time… I have been successful in getting carousels to display in random order by using orderby=rand… wanted to incorporate random display further throughout the site…want it to be in panel and not sidebar like some plugins do it…

    Haven’t had much luck in my research and am reaching out to anyone that may have had some success in modifying display options…

    Any advice or insight would be greatly appreciated…

    Thanks,

    R



    Peter
    Newbie
     
    1 points

    I am pretty sure you can go into the shortcode and change the syntax to random. I just looked at it and the querie string can do this as well


    Richard
    Richard
    Newbie
     
    51 points

    Hey Peter,

    Thanks for the insight…

    Are you talking about going into General Setting >> Page Setup >> Listings… I can look at shortcode there but, I’m not sure this is where you are talking about…

    Can you clarify…?

    Thanks,

    R


    Josh
    Josh
    Super Guru
     
    13,103 points

    Hello Richard,
    Please go to Appearance >Editor >home-layout-comparison1.php
    Locate:

    
    custom="new"
    change it to:
    custom="random" 
    

    Richard
    Richard
    Newbie
     
    51 points

    Hey Josh,

    Thanks this works on the tab version of carousel on the homepage…I have the tabs disabled and have the random display working well for that currently…

    What I’m looking for is the ability to control or have random display on:

    content-post.php which is the blog display…

    &

    content-listing-comparison.php which is the listing page display…

    This is where I have hit a brick wall… is there a place similar to what you have already described which would allow me to swap out “newest” or something like that from the search criteria settings to set as “random”?

    Thanks again,

    R


    Josh
    Josh
    Super Guru
     
    13,103 points

    Hello Richard,
    Replace the file search-results.php and tpl-blog.php with my attached files (unzip my files first)

    Attachments:
    You must be logged in to view attached files.

    Josh
    Josh
    Super Guru
     
    13,103 points

    My file 2

    Attachments:
    You must be logged in to view attached files.

    Richard
    Richard
    Newbie
     
    51 points

    Hey Josh,

    Thank you for these…

    The search-results.php is allowing the listings or products to randomize however, without moving the order and orderby the query is the same each time and not truly random on each refresh; it’s basically a locked new order that is not random… also, it breaks categories and lumps them into any random category without the necessary separation of per category exclusive randomizing … I played around with the order and orderby and was able to achieve pure random results on each refresh but, the category jumping is the issue I see… (i.e) Health category will have Gadgets category Listings in its category and vice versus…

    The tpl-blog.php is not allowing for the blogs to randomize…I see the rand order request in there it’s just not allowing it for some reason…

    Is there possibly an area I should be looking at to see if I am missing something…

    Again I really appreciate the assistance and insight into this…

    Thanks again,

    R


    Richard
    Richard
    Newbie
     
    51 points

    Josh,

    Do happen to have any further insight on achieving random displays within categories for listings and blog posts that stay true to each category and search results?

    Thanks again,

    R


    Richard
    Richard
    Newbie
     
    51 points

    Hey Josh,

    I was able to figure out how to get the blog posts to randomize and stay within their respective categories throughout the site… of all places it was the Main Index Template or index.php… I simply looked for php that specified “if (have_posts()) :” then I added <?php query_posts(‘orderby=rand’); ?> … super quick and simple and it does it clean…

    Now that is for blog posts… I was wondering if you had any insight on listings or the query call for them specifically besides “query_posts”… the reason I ask is replacing the name “posts” with “listings” directly does not work… I am not a classical coder… self taught so I can see things in my mind that work but, really can’t explain them…and I may miss something as simple as knowing the query for listings…

    I am pretty certain we would add the query whatever that might be technically for listings in the Taxonomy Template or taxonomy.php just like I did above with <?php query_posts(‘orderby=rand’); ?> but, not the general posts call… I have tested it and it grabs the blog posts not the listings…but, the location seems to work and stays in line with the theme…

    I have also been able to grid the blog & product or listing pages instead of listing row style manually which others have had trouble with as well and this hurdle is my last I believe… just need to figure the call for listings as opposed to direct posts…so I can retest…

    I might be missing something simple here and that is why I’m asking for your insight or anyone on here that may know… I am hoping this may help some others that have run into the same hurdles I have…

    Thanks in advance,

    R


    Richard
    Richard
    Newbie
     
    51 points

    Update: it is still crossing categories or pulling categories from other locations with random results… so still working on that on staying category specific per category and still have random display results….


    Richard
    Richard
    Newbie
     
    51 points

    Update: Got it figured out by a third party (at least I am keeping my finger crossed) on blog posts & listing posts to display randomly and keep it category specific as well as stay inline theme panels… Thank everyone for the help & insight…

    Thanks again,

    R


Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.