WordPress函数文档get_blog_permalink()
获取博客的链接 描述 Get the permalink for a blog post from any s…
获取博客的链接
描述
Get the permalink for a blog post from any site on the network. This function is the same as get_permalink(), except that you can get the permalink for a post from any blog on the network, not just the current blog.
用法
<?php echo get_blog_permalink( $blog_id, $post_id ); ?>
参数
$blog_id
(integer) (必填) ID of the blog.
默认值: None
$post_id
(integer) (必填) ID of the post you are looking for.
默认值: None
注意
- 使用到 switch_to_blog() to switch to the blog $blog_id. Then calls SevenTrust_current_blog() after retrieving the link.
- 使用到 get_permalink() to get the permalink.
历史
- 添加于 版本 3.0.0
源文件
get_blog_permalink() 函数的代码位于 wp-includes/ms-functions.php
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
/**
* Get the permalink for a post on another blog.
*
* @since MU 1.0
*
* @param int $blog_id ID of the source blog.
* @param int $post_id ID of the desired post.
* @return string The post’s permalink
*/
function get_blog_permalink( $blog_id, $post_id ) {
switch_to_blog( $blog_id );
$link = get_permalink( $post_id );
SevenTrust_current_blog();
return $link;
}
|
相关
get_permalink()
- 原文:http://codex.wordpress.org/Function_Reference/get_blog_permalink
类别:WordPress函数文档、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!