Random post like wordpress.com
-
I have seen this topic several times already, but I never found one which had a satisfactory answer.
http://wordpress.org/support/topic/how-to-display-a-random-post-link-just-like-wordpresscom?replies=3
http://wordpress.org/support/topic/link-to-random-post-by-category?replies=4
http://wordpress.org/support/topic/link-to-random-post-from-specific-category?replies=1If you go to http://www.yourdomain.com/?random you’re taken to a random post/page.
I would like to include a link to /?random in my menu, but I would like to be able to control what is shown. For example only posts in category X.
On http://www.skatehousemedia.com/home you can see it working and afaik it’s a self hosted wp site, not on wordpress.com.
-
Yes. That’s a WordPress.ORG site.
Try plugins: http://wordpress.org/plugins/search.php?q=random+posts
Also, I checked the links posted by you. The second link gives a solution.
I don’t want to use a plugin, plus I haven’t found one which does exactly what I want. I’ld prefer to code it myself and I think it should’t be that hard.
I know how to query a random post, but I don’t know how to ‘control’ /?random and that’s what I’ld like to do.
Just add
/?random
to your URL and try a few times (after visiting some other links of the same site). You may get different links each time – as the name suggests that’s random!Yes, that works, BUT I don’t want to display any pages and only posts from a certain category (and preferably even from a certain time period).
I think it is possible to write a custom function and hook it into some action, but I don’t know which.
Take a category and use the same random code. It should work.
my site is http://www.freerides.org.
If I go to http://www.freerides.org/?random it works but I get results I don’t want to see, like pages. ie. login pages, lost password page, etc.
- The topic ‘Random post like wordpress.com’ is closed to new replies.