new rss channel

This commit is contained in:
arlemp@selectel.ru
2022-02-21 13:53:43 +03:00
parent 9f2f3e0805
commit 3727594359
3 changed files with 81 additions and 0 deletions

View File

@@ -27,6 +27,17 @@ $posts = get_posts( array(
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
));
// Яндекс Новости
create_rss_file($posts, 'views/rss/yanews.php', '/vhosts/beta/rss/yanews.xml');
// Общая лента
create_rss_file($posts, 'views/rss/yanews.php', '/vhosts/beta/rss/news.xml');
exit;
if( $posts ){
@@ -44,6 +55,30 @@ if( $posts ){
}
function create_rss_file($posts, $temp, $file){
if( $posts ){
ob_start();
include($temp);
$result = ob_get_contents();
ob_end_clean();
$result = trim($result);
if ($result !== ''){
file_put_contents($file, trim($result));
}
}
}