diff --git a/functions.php b/functions.php index 106a9fa..47c1797 100644 --- a/functions.php +++ b/functions.php @@ -636,3 +636,15 @@ add_action( 'pre_get_posts', function ($query) { }); +function add_text_to_the_feed_end( $content ){ + $content .= ' +
+ Источник: '. get_bloginfo('name') .'. +
+ '; + + return $content; +} +add_filter( 'the_excerpt_rss', 'add_text_to_the_feed_end' ); + + diff --git a/rsscreate.php b/rsscreate.php index 14ee3dc..9ff478f 100644 --- a/rsscreate.php +++ b/rsscreate.php @@ -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)); + } + + + } + + + +} + diff --git a/views/rss/rssnews.php b/views/rss/rssnews.php new file mode 100644 index 0000000..06e51dc --- /dev/null +++ b/views/rss/rssnews.php @@ -0,0 +1,34 @@ +';?> +