khero 0 Report post Posted October 13, 2011 I would like to randomize the order of the posts in "theloop", only in the home/posts page. Is there an easy way to assign this order to the homepage, also without affecting search results or category pages? Thanks! Share this post Link to post Share on other sites
Kate 3 Report post Posted October 13, 2011 Do you already have your PHP for the query call? You can do it one of two ways: 1) You can add a hook 2) You can add the code to template.postloop.php. (If you go this route, you should copy the file to your Base theme.) Either way, you can add an if statement that checks if it's the home page, and changes the query based on that. Share this post Link to post Share on other sites
khero 0 Report post Posted October 13, 2011 Thanks Kate. I don't have the base theme installed. I've only installed Pro and tweaked the CSS from the platform control panel. Can i ask you to be a bit more specific, maybe posting an example of coding for both ways. It's the first time i work with PHP but i have a C++ and ASP background so i know the theory behind it, i'm just lacking the syntax ;) Share this post Link to post Share on other sites
Kate 3 Report post Posted October 13, 2011 Sorry... to clarify: you need the code for the randomization, where to put it, or both? Share this post Link to post Share on other sites
Rob 547 Report post Posted October 13, 2011 You must add and activate platformbase in order for Platform to work properly and securely. If not, when there's an upgrade, your customizations will be overwritten. Former PageLines Moderator, Food Expert and Raconteur Share this post Link to post Share on other sites
khero 0 Report post Posted October 14, 2011 @rangealone i changed some PHP stuff in platformpro/template.postloop.php. you mean it was better if i had created a file called "template.postloop.php" and put it in "platformbase" theme folder, copying the entire original page but with my changes? if so, i think i'm still in time right? @Kate hehehehe, both would be awesome! i know i need to add a "order by = random" kinda thing to the post_query, but i can't find this. other tutorials i found show a different code for the post_query rather than the one i find in platform. Share this post Link to post Share on other sites
Rob 547 Report post Posted October 14, 2011 I mean you can copy the default (unchanged) template.postloop.php from wp-content/themes/platformpro and upload it to wp-content/themes/platformbase, then adding your changes, but essentially, what you said works too. Just a different way to go about it. Don't change the file name. Former PageLines Moderator, Food Expert and Raconteur Share this post Link to post Share on other sites
khero 0 Report post Posted October 19, 2011 @Kate Hello Kate, any news about that code? ;) Share this post Link to post Share on other sites
khero 0 Report post Posted October 19, 2011 This is what WP suggests, but i would need to know if platform changed the default variable names and how to integrate this code in "template.postloop.php" (at least this is the page i think i should be working on): 5, 'orderby' => 'rand' ); $rand_posts = get_posts( $args ); foreach( $rand_posts as $post ) : ?> Share this post Link to post Share on other sites