現在位置: 首頁 > 電腦科技 > wordpress > 正文
wordpress – 為網址加入rss輪播
2010年12月08日 wordpress ⁄ 共 3118字 Comments Off on wordpress – 為網址加入rss輪播 ⁄ 被围观 1,711 views+

Simply RSS Fetcher

相當好實用,可以為你的網址加入rss輪播功能,插入你喜歡的rss 文章,當然要支援rss的網站才行啦。

安裝好插件後也沒什麼雖要設定,啓用就行,不過想要插入rss呢,就要搞少少動作。

 

啟用Simply RSS Fetcher外掛之後,請在你的THEME佈景主題的你喜歡的地方加上:

<?php srssfetcher('http://RSS網址/', 5, true, false, true, false); ?>

這樣的控制碼即可。

如果你怕外掛出問題時整個網頁會卡在一半,可以加上一個判斷的規則:

<?php if (function_exists('srssfetcher')) srssfetcher('http://RSS網址/', 5, true, false, true, false); ?>

 

他會先判斷功能是否存在,有功能則顯示。

 

參數說明:

 

<?php srssfetchers('feed', [msgs], [list], [timestamp], [linked], [encode_utf8]); ?>

feed:RSS網址,一般部落格、twitter、新聞網站的RSS來源皆可。

msgs:顯示的標題數量。

list:是否以清單方式顯示,可設定為true或false。

timestamp:是否顯示發文時間,可設定為true或false。

linked:是否加上該網址的超連結?可設定為true或false。

encode_utf8:是否以utf8編碼顯示文字內容?可設定為true或false。

如果你設定好之後,發現文字呈現亂碼,請調整「encode_utf8」這參數的true或false。另外,我們也可自行設定RSS的更新頻率,請修改「srssfetcher.php」檔案第30行左右的地方(120表示120秒更新一次):

define('MAGPIE_CACHE_AGE', 120);

 

如果你希望按下標題後可以開新視窗顯示頁面,請修改「srssfetcher.php」檔案第70行左右的地方,加上「target="_blank"」即可。

資料出處「重灌狂人」

這個插件缺點就是太簡短,不過呢,有得用就是,還有一個英文的,看來也不錯,都安來試用一下算了。

 

SmartRSS Plugin is a WordPress plugin

 

Transform your blog into an automated posting tool by syndicating with multiple RSS feed sources!

 

Features:

- administration tool for managing rss feeds

- each feed can be assigned to a specific category

- after importing the feed, you may display related feeds by using the provided code below

- cron job for importing feeds as a scheduled period

 

Package contains:

 

- smart_rss.php file - the backend plugin

- wp_smartrss.php - the cron job file which does the import

 

Installation:

 

- upload files smart_rss.php to the wp-content/plugins directory of your wordpress installation

- go into your Plugins administrator tab and activate it

- you will be able to access the plugin backend by going to the Options tab -> the SmartRss subtab

- upload wp_smartrss.php to your wordpress home path, for security reasons i would suggest you rename this file to something you like

- to start importing fields go to http://sitename/wp_smartrss.php url, if you would like to do this automatically you can setup a cron job to run that file

- to setup the cron job use a code similar to this:

 

“nice –adjustment=19 /usr/bin/php /$full-path-to-the-file/wp_smartrss.php”

or

“nice –adjustment=19 /usr/bin/php /$full-path-to-the-file/your_file_name.php”

 

- if you would like to put this file somewhere else on the server, you need to edit the line from the file wp_smartrss.php containing

require_once(’wp-config.php’);

and replace it with something like

like require_once(’/$full-path-to-wordpress/wp-config.php’);

where $full-path-to-wordpress is the full path to your wordprss installation folder

 

Related Articles Display

 

- to display the related articles add this code in your single.php page from your template directory:

 

< ?php related_posts(5, 10, '<li><b style="font-size:14px;">', '</b<', '', '', false, false); ?>

 

Function parameters: smartrss_related_posts(limit, len, before_title, after_title , before_post, after_post , show_pass_post, show_limit)

- limit = the related posts limit to be displayed

- len = if show_limitis set then it will limit the post size to $len words

- before_title = html code to add before post title

-after_title = html code to add after post title

-before_post = html code to add before post

-after_post =html code to add after post

-show_past_post = include posts that are password protected

-show_limit = limit the post text to $len words

Demo link: http://www.devplug.net

下載:http://www.devplug.net/download/smartrss.zip

抱歉!評論已關閉.