Jump to content

Wordpress random posts in front page


Astaroth0803

Recommended Posts

Hello

I’d like to have certain posts (defined by category, tag, whatever is best) to randomly appear among my usual blog posts on the Wordpress front page. To make it a bit clearer – I’d like to have these posts serve as random ads mixed with regular non-ad posts.

I was able to have ALL my posts appear randomly by inserting this line on top of my index.php file (found in one of the topics on the Wordpress support forum):

<?php query_posts($query_string . ‘&orderby=rand’) ?>

but I’d only like certain posts to behave that way.

 

Unfortunately I don’t know php, but it seems to me that the easiest way to achieve this is to have this in my index.php

<?php query_posts($query_string . ‘&orderby=rand’) ?>

only with the added condition that it applies to posts assigned to specific category/tag. Unfortunately I don’t know how such a condition can be added in php, so any help will be highly appreciated.


You can have a you look at my test page here http://athenagfx.com/philoxeniatest

 

Thank You
 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.