开发者

Randomizing Picture Links on a Wordpress Blog

On my webs开发者_开发知识库ite, I have a section in my right-side navigation dedicated to "seasonal" projects. I want these to be automated and change automatically. Is there a php function that does this? Currently, I simply do it manually w/ html.

My thoughts are that I can somehow seperate, Winter, Fall, Summer, Spring projects, and then call each folder when the time comes. It would also be have to called on a certain date. If anyone could help or point me towards a useful resource, I'd very much appreciate it.

Website: http://www.merrimentdesign.com

The section on the site I am referring two is titled Top Winter Projects.


What you want to do is query for posts based on Date Range, define said range for Spring, Summer, Fall, Winter, code below should get you started.

http://codex.wordpress.org/Template_Tags/query_posts#Time_Parameters

There are some examples there, but basically you would do something like this (wordpress example):

// Create a new filtering function that will add our where clause to the query function filter_where( $where = '' ) { // posts for March 1 to March 15, 2010 $where .= " AND post_date >= '2010-03-01' AND post_date < '2010-03-16'"; return $where; } add_filter( 'posts_where', 'filter_where' );

query_posts( $query_string );

IF you posts have a post images you would show said post images, if your theme does NOT support them then you would need to read through here:

http://codex.wordpress.org/Post_Thumbnails

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜