get_bloginfo_rss()

获取博客的RSS相关信息

描述

bloginfo函数的http://en.wikipedia.org/wiki/Rss RSS]集装箱。
可以用 get_bloginfo()函数检索任何想要检索的信息。当函数值在feed中被检索以供使用时,所有值的标签都将被除去,字符也将被转换。

用法

<?php get_bloginfo_rss( $show ) ?>

参数

$show

(string) (可选) Informational detail about your blog. Valid values:

默认值: ”

  • ‘name’ – Weblog title; set in General Options. (Default)
  • ‘description’ – Tagline for your blog; set in General Options.
  • ‘url’ – URL for your blog’s web site address.
  • ‘rdf_url’ – URL for RDF/RSS 1.0 feed.
  • ‘rss_url’ – URL for RSS 0.92 feed.
  • ‘rss2_url’ – URL for RSS 2.0 feed.
  • ‘atom_url’ – URL for Atom feed.
  • ‘comments_rss2_url’ – URL for comments RSS 2.0 feed.
  • ‘pingback_url’ – URL for Pingback (XML-RPC file).
  • ‘admin_email’ – Administrator’s email address; set in General Options.
  • ‘charset’ – Character encoding for your blog; set in Reading Options.
  • ‘version’ – Version of WordPress your blog uses.

The following work in WordPress version 1.5 or after:

  • ‘html_type’ – “Content-type” for your blog.
  • ‘wpurl’ – URL for WordPress installation.
  • ‘template_url’ – URL for template in use.
  • ‘template_directory’ – URL for template’s directory.
  • ‘stylesheet_url’ – URL for primary CSS file.
  • ‘stylesheet_directory’ – URL for stylesheet directory.

返回值

(string) 

示例

RSS2 URL

Assigns the URL of your blog’s RSS2 feed to the variable $rss2_url.

<?php $rss2_url = get_bloginfo_rss(‘rss2_url’); ?>

注意

  • 使用到: apply_filters() 调用 ‘get_bloginfo_rss‘ hook with two parameters.

历史

添加于 版本: 1.5.1

源文件

get_bloginfo_rss() 函数的代码位于 wp-includes/feed.php.

* RSS container for the bloginfo function.
*
* You can retrieve anything that you can using the get_bloginfo() function.
* Everything will be stripped of tags and characters converted, when the values
* are retrieved for use in the feeds.
*
* @since 1.5.1
* @see get_bloginfo() For the list of possible values to display.
*
* @param string $show See get_bloginfo() for possible values.
* @return string
*/

function get_bloginfo_rss($show = ”) {

$info = strip_tags(get_bloginfo($show));

/**

* Filter the bloginfo for use in RSS feeds.
*
* @since 2.2.0
*
* @see convert_chars()
* @see get_bloginfo()
*
* @param string $info Converted string value of the blog information.
* @param string $show The type of blog information to retrieve.
*/

return apply_filters( ‘get_bloginfo_rss’, convert_chars( $info ), $show );

}

原文:http://codex.wordpress.org/Function_Reference/get_bloginfo_rss

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索