June 1, 2012 at 3:58 pm #1427
I have a portfolio site that uses thumbnails to display posts on the homepage. Because it uses posts, it sorts by latest date created. This is not bad per say, but I would rather the posts show randomly or something similar. I am thinking like you would see in a gallery slider….random images.
There is probably a simple back-end tweek to the functions.php for this I would imagine? But I don’t know, that’s why I always come here to get the straight dope.
Thanks, MattJune 4, 2012 at 7:48 am #1428
Yeah actually, that shouldn’t be too hard. A query can be set up on the portfolio template, or from function.php. I just got back from vacation – I should be able to post something to try out soon!June 5, 2012 at 10:38 am #1429
So, are you familiar working with query_posts, get_posts, WP_Query, etc? Just the various ways of modifying a loop and calling posts?
Basically you can run a query calling to the number of posts you wish or whatever, and then set the orderby parameter to rand.
That’s a couple examples showing get_posts and query_posts. It all works, you can run that query before the start of your loop in your template. Or you can run the query from functions.php
There’s my article describing how that might work. Depending how your templates are set up, or if you run the query from functions.php, you would need to conditionalize for is_home or is_front_Page or whatever is appropriate. That should help get you there, if not, lemme know and I can throw up some code examples!October 10, 2012 at 1:14 am #1507
This is awsome…thank you again. Sorry for the late reply.
I am not familiar with modifying a loop or calling posts, but you have given me enough to start experimenting on. I’ve yet to not come out successful with your help.
I really do like my theme, but don’t like how my “favorite” pieces would continuously get pushed back as I add more posts. Thought about adding a slider, but would take away from the look I have now.October 13, 2012 at 2:35 pm #1518
I’m definitely kind of back and forth with regards to sliders. I have a new theme on my personal blog at http://www.rvoodoo.com with a nifty ‘featured’ section. I’m pretty fond of that right now to be honest. The theme is favepersonal from crowdfavourite – my first premium theme, I wanted a facelift quickly – I’ve been working on my own custom theme for months, and just don’t have the time to put in to it….
Hopefully you can figure out what you are looking for with regards to your random posts easily. You really can do a lot to display posts in various ways, multiple loops, etc. But it can take a bit of time to learn. My hardest part is conceptualizing…. I can figure out how to code something once I know what I want, but I have a helluva time pinning down exactly what I want a lot of the time.
You must be logged in to reply to this topic.