Files
vij/rsscreate.php

50 lines
951 B
PHP
Raw Normal View History

2021-10-11 22:29:11 +03:00
<?php
include_once '/vhosts/beta/wp-load.php';
2021-12-28 21:37:04 +03:00
function filterHtml($html) {
$html = trim($html);
$html = preg_replace('/(\>)\s*(\<)/m', '$1$2', $html);
return preg_replace('/<!--(.*?)-->/', '', $html);
}
2021-10-11 22:29:11 +03:00
date_default_timezone_set('Europe/Moscow');
$posts = get_posts( array(
2022-01-11 23:06:02 +03:00
'numberposts' => 20,
2021-10-11 22:29:11 +03:00
'category' => 2,
'orderby' => 'date',
'order' => 'DESC',
'include' => array(),
'exclude' => array(),
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'post',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
));
if( $posts ){
2022-02-15 21:00:14 +03:00
ob_start();
include('views/rss/yanews.php');
$result = ob_get_contents();
ob_end_clean();
$result = trim($result);
if ($result !== ''){
file_put_contents('/vhosts/beta/rss/yanews.xml', trim($result));
}
2021-10-11 22:29:11 +03:00
}