views:

25

answers:

4

Hi,

I'm looking for a solution to regularly show a post on the startpage. The way to archieve this is to update the last modification date of a post, which can be easily done using an SQL statement. Alas this skips the regular Wordpress update hooks such as "post new entries to twitter".

So I'm looking for a PHP cronjob script to "emulate" the user updating the modification date of a post and clicking the publish button.

How can I do this? Adding wp_load.php to my script and then ... ?

Thanks for advice, Johannes

A: 

You can modify your template/theme file to show specific posts or almost anything else...

All you need to know is a little PHP and browse the WordPress Codex

Check out query_posts(): http://codex.wordpress.org/Function_Reference/query_posts

smdrager
+1  A: 

You can't use the "Stick this post to the front page" function under "Visibilty" in the "Publish" section of the post editor? And then use your Twitter plugin posting options to retweet when the post is edited?

songdogtech
A: 

Thanks for your responses so far, but I'm not sure if I described my goals correctly. I don't want to stick posts, I need a feature similar to the Unix "touch" - modify a post's creation date to NOW and (in the case of wordpress) execute all new post handlers such as post to twitter.

query_posts is indeed a useful function to style the startpage, but it doesn't go far enough in my case.

Johannes
A: 

What is this startpage?

I can only think of a Homepage in your case, and as you have stated before, You could include wp-load.php and then create the loop.

If you are trying to grab the latest post in your wordpress blog and update the date to today's current date, you will probably need to do a query in the wordpress database.

$wpdb->query("UPDATE wp_post SET post_date = date WHERE id = id");

The above query will need some modification. From there you can put that in a cronjob.

Anraiki