让WordPress的订阅功能feed订阅内容也展现广告
在WordPress程序做的网站上投放广告,如果开放了feed订阅,而且订阅用户非常多的话,而feed输出的内容里又没有设置广告展现,会非常影响站长的广告收入,下面的代码可以让feed的内容也出现广告:
if ( !function_exists('custom_feed_footer') ) { function custom_feed_footer($content) { if(is_feed()) $content .= '你的广告代码'; return $content; } add_filter('the_excerpt_rss', 'custom_feed_footer'); add_filter('the_content', 'custom_feed_footer'); }
将你的广告代码加在$content .= '';的引号中,并复制粘贴到当前主题模板的functions.php文件中,在feed订阅内容中就展现广告。
本文标题:《让WordPress的订阅功能feed订阅内容也展现广告》
本文链接:https://zhangwenbao.com/wordpress-subscription-content-unfolds-advertising.html