首頁 › 用WP-Sticky做文章置頂及高亮
用WP-Sticky做文章置頂及高亮
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。
- 人氣(1996)
最新回應
- 最近發現國外有一套針對Drupal的佈景主題產生器,還不錯
3 天 18 小時前 - 您好:
冒昧打擾您了,
目前我有個專案正在進行,
很希望與
2 周 6 天前 - .............
4 周 3 天前 - Our
9 周 4 天前 - 真是AJAX吗?
16 周 5 天前 - 不好意思
有個問題可以請問你嗎
javascript的基本
22 周 6 天前 - 我工作的公司在找能協助維護一個用Drupal
25 周 6 天前 - lol ,花水木粉絲萬歲~
27 周 49 分鐘前 - 其實在下原本就是花水木的fans啦…只是一直都不敢回文
31 周 1 天前 - 请问,可否发一个license呢
xiang.leau@g
32 周 5 天前
熱門內容
- Plurk2:噗浪插頭的貼紙美化 (13,341)
- [Module] AJAX Comments (7,484)
- [網站易用性] 下拉式選單的迷思 (6,359)
- Plurk2:花水木版圓角作法&原始檔 (6,204)
- Drupal開發用版型 (5,731)
找我聊聊
敲我MSN吧!
若我MSN下班,搞不好在這
或是在這













回應
麻烦介绍下这个插件的功能好不?呵呵
很佩服你这么有技术天分的丫头We're sorry, but the spam filter thinks your submission could be spam. Please complete the CAPTCHA.
發表新回應