du27271 2011-01-17 16:34
浏览 47
已采纳

随机化Wordpress博客上的图片链接

On my website, 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.

  • 写回答

1条回答 默认 最新

  • douyan2970 2011-01-17 16:45
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 wpf datagrid如何实现多层表头
  • ¥15 为啥画版图在Run DRC会出现Connect Error?可我Calibre的hostname和计算机的hostname已经设置成一样的了。
  • ¥20 网站后台使用极速模式非常的卡
  • ¥20 Keil uVision5创建project没反应
  • ¥15 mmseqs内存报错
  • ¥15 vika文档如何与obsidian同步
  • ¥15 华为手机相册里面的照片能够替换成自己想要的照片吗?
  • ¥15 陆空双模式无人机飞控设置
  • ¥15 sentaurus lithography
  • ¥15 关于#linux#的问题:子进程1等待子进程A、B退出后退出(语言-c语言)