shortcode怎么用_如何通过Shortcode在WordPress帖子中嵌入外部RSS Feed

本文介绍了如何通过在WordPress帖子中使用Shortcode来保持列表文章的时效性,避免手动更新链接导致的内容过时问题。教程提供了一段PHP代码,用于在functions.php文件中实现这一功能,并展示了如何在编写帖子时使用Shortcode,同时允许自定义RSS源URL和显示条目数量。
摘要由CSDN通过智能技术生成

shortcode怎么用

Have you ever seen showcases like 25 best XYZ sites to follow? Usually these tutorials have the site name, site screenshot, a small description, and the list of recent posts. The main issue with those posts are the list of recent posts which gets outdated overtime because most authors manually create those links at the time of writing. That post is really outdated as soon as any one of those other sites publish a new post. Well in this article, we will show you how to embed an external RSS feed in WordPress posts via shortcode, so you can keep your list posts relevant.

您是否见过像25个最佳XYZ网站这样的展示柜? 通常,这些教程包含站点名称,站点屏幕截图,简短描述以及最近发布的列表。 这些帖子的主要问题是最近的帖子列表,这些列表超时了,因为大多数作者在撰写本文时都手动创建了这些链接。 只要其他任何一个站点发布新帖子,该帖子实际上就已经过时了。 在本文中,我们将向您展示如何通过简码将外部RSS feed嵌入WordPress帖子中,以便使列表帖子保持相关性。

First thing you need to do is open your theme’s functions.php file and paste the following code:

您需要做的第一件事是打开主题的functions.php文件,并粘贴以下代码:

//This file is needed to be able to use the wp_rss() function.
include_once(ABSPATH.WPINC.'/rss.php');

function readRss($atts) {
    extract(shortcode_atts(array(
	"feed" => 'http://',
      "num" => '1',
    ), $atts));

    return wp_rss($feed, $num);
}

add_shortcode('rss', 'readRss');

Now all you have to do is use this shortcode when writing a post:

现在您所要做的就是在编写帖子时使用以下短代码:

[rss feed="http://feeds.feedburner.com/wpbeginner" num="5"]

Make sure you change the feed URL in the shortcode to what you want. You can also adjust the number to your liking.

确保将简码中的供稿网址更改为所需的网址。 您也可以根据自己的喜好调整数字。

Source: Smashing Magazine

资料来源:《 粉碎杂志》

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-embed-an-external-rss-feed-in-wordpress-posts-via-shortcode/

shortcode怎么用

short_term_ref_pic_set_idx是一个参数,用于指示当前slice应该选择的short-term参考图像集(ref pic set)的序号。 在C语言short_term_ref_pic_set_idx可以是一个整型变量,表示short-term RPS的索引。根据相应的SPS和slice header的设置,该参数将确定选择哪个short-term RPS作为当前slice的参考图像集。 例如,如果short_term_ref_pic_set_sps_flag为0,那么short_term_ref_pic_set_idx将用于在SPS的0到64个short-term RPS选择一个特定的RPS。这将决定在当前slice使用哪个short-term参考图像集。 另一方面,如果short_term_ref_pic_set_sps_flag为1,那么slice header的一个short-term RPS结构将被整个picture使用,而不使用short_term_ref_pic_set_idx进行选择。 因此,short_term_ref_pic_set_idx的值决定了在编码和解码过程使用哪个short-term RPS。具体的short-term RPS内容和设置将由对应的short-term RPS序号指定。 相关问题: 1. short-term参考图像集(RPS)的作用是什么? 2. SPSshort-term RPS的数量有何限制? 3. 如何通过short_term_ref_pic_set_sps_flag选择short-term RPS? 4. 在编码过程如何创建和管理short-term RPS?<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [HEVC的参考队列解码](https://blog.csdn.net/qq_32430349/article/details/50972814)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值