首頁 › 用WP-Sticky做文章置頂及高亮
用WP-Sticky做文章置頂及高亮
花水木在2009-01-22 (四) 12:31初次發表,在2009-01-31 (六) 16:02做了最後更新。
http://lesterchan.net/wordpress/readme/wp-sticky.html
本篇介紹WP-Sticky的用法。他有兩種功能,分別叫做Announcement Posts和Sticky Posts,所謂的Announcement Posts就是會永遠在最上方,而Sticky Posts則是在「當日」最上方。
以下範例來自官方,可以很清楚表達兩者差異。
Announcement
- Post 5 (Announcement Post)29th March 2007
- Post 6
- Post 7
- Post 828th March 2007
- Post 4 (Sticky Post)
- Post 1
- Post 2
- Post 3
用法
打開佈景原始檔,輸入想要的東西,如下。
The Post Sticky Status
<?php post_sticky_status($before,$after); ?>
$before 文字之前要出線的字
$after 文字之後要出線的字
Announcement Banner
如果你的佈景使用the_date();,這東西會自動出現,如果沒出現的話,可以手動加上:
<?php announcement_banner(); ?>
判斷是否為置頂文章
<?php if(is_announcement()): // If post is an Announcement else: // If post is NOT an Announcement endif; ?>
以此類推
<?php if(is_stickied()): // If post is Sticky else: // If post is NOT Sticky endif; ?>
用CSS美化
CSS的class分別是sticky_post和announcement_post。
- 人氣(3316)
Recent Comments
熱門內容
- Drupal | 用hook_menu_alter來修改tab項目 (192,711)
- 第一次玩弄Drupal就不上手 (183,801)
- 六個網站測速工具 (103,109)
- Drupal 的 Eye Candy? (71,120)
- Introduction to Drupal 簡報分享 (35,917)
找我聊聊
敲我MSN吧!
若我MSN下班,搞不好在這
或是在這













回應
麻烦介绍下这个插件的功能好不?呵呵
很佩服你这么有技术天分的丫头We're sorry, but the spam filter thinks your submission could be spam. Please complete the CAPTCHA.
mYlMvs zmjrbienfzrm, [url=http://zmttgffgdcau.com/]zmttgffgdcau[/url], [link=http://xctjsyaxzhpk.com/]xctjsyaxzhpk[/link], http://ailoupipxzuu.com/
發表新回應