Ana dizininizde yandex.php isminde bir sosya oluşturunuz. Bu dosyaya aşağıdaki verdiğim kodları kendinize göre düzenleyerek ekleyiniz:
(Sadece wordpress içindir) <?php
if (! isset($wp_did_header)):
if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
else $path = 'wp-admin/';
require_once( dirname(__FILE__) . '/wp-includes/classes.php');
require_once( dirname(__FILE__) . '/wp-includes/functions.php');
require_once( dirname(__FILE__) . '/wp-includes/plugin.php');
wp_die("wp-config.php dosyasinin olup olmadigini kontrol ediniz.");
}
$wp_did_header = true;
require_once( dirname(__FILE__) . '/wp-config.php');
wp();
gzip_compression();
require_once(ABSPATH . WPINC . '/template-loader.php');
endif;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Markafem Yandex Rss</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="tr" />
</head>
<body>
<?php
$data = '<?xml version="1.0" encoding="utf-8"?>';
$data .= "\n".'<rss version="2.0" xmlns="http://backend.userland.com/rss2" xmlns:yandex="http://haber.yandex.com.tr"';
$data .= "\n".'xmlns:media="http://search.yahoo.com/mrss/">';
$data .= "\n<channel>";
$data .= "\n<title>Markafem</title> ";
$data .= "\n<link>http://www.markafem.com</link> ";
$data .= "\n<description>Markafem, haber, spor, magazin, teknoloji gibi alanlarda internetin hızlı ve etkileyici değişimini uluslararası boyutta takip eden bir medya ekibidir. Markafem Türkiye ve dünya ile ilgili gündem başlıklarını ziyaretçilerine ileten başlıca haber kaynağıdır. Markafem kollektif, bağımsız ve açık sözlü tarzıyla, Sosyal Medya ekibini oluşturmuştur. Ticari faaliyetlerinin tamamını kendi bünyesinde sürdürmektedir.</description> ";
$data .= "\n<image> ";
$data .= "\n<url>http://www.markafem.com/wp-content/uploads/2014/01/markafemlogo1.png</url>";
$data .= "\n<title>Markafem</title> ";
$data .= "\n<link>http://www.markafem.com</link>";
$data .= "\n</image> ";
function filter_where($where = '') {
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-7 days')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
query_posts( 'posts_per_page=1000&cat=5,13,6,8,9221,7,422,9,1491,10,1338,12&orderby=date' );
if (have_posts()) : while (have_posts()) : the_post();
$category = get_the_category();
$content = get_the_content_feed('rss2');
$title = get_the_title($post->post_parent);
if ( $parent_title != the_title(' ', ' ', false) ) {
}
$page_id = get_post( $id );
$link = get_permalink( $page_id );
$desc = substr(esc_textarea( strip_tags( $content ) ),0,150)."...";
$data .= "\n<item>
<title>".$title."</title>
<link>".$link."</link>
<description>".esc_textarea( strip_tags( $desc ) )."</description>
<author>".the_author()."</author>
<category>".$category[0]->cat_name."</category>
<enclosure url=\"".wp_get_attachment_url( get_post_thumbnail_id($post->ID) )."\" type=\"image/jpeg\"/>
<pubDate>".mysql2date('D, d M Y H:i:s +0300', get_post_time('Y-m-d H:i:s', true), false)."</pubDate>
<yandex:genre>message</yandex:genre>
<yandex:full-text>".esc_textarea( strip_tags( $content ) )."</yandex:full-text>
</item>";
endwhile;else : endif;
$data .= "\n</channel>
</rss>";
$file = 'yandex.xml';
$fp = fopen($file, "w");
if($fp){
fwrite($fp, $data);
fclose($fp);
}
?>
</body>
</html>Yandex'e ise rss feed bağlantınızı
http://www.imctv.org/yandex.xml şeklinde veriniz.
Her yeni haber girildiğinde
http://www.imctv.org/yandex.php sayfasını 1 defa ziyaret edinizki gönderileri yandex.xml dosyasına, oradanda yandex haberlere yollasın sistem.
<?php
if (! isset($wp_did_header)):
if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
****if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
****else $path = 'wp-admin/';
require_once( dirname(__FILE__) . '/wp-includes/classes.php');
require_once( dirname(__FILE__) . '/wp-includes/functions.php');
require_once( dirname(__FILE__) . '/wp-includes/plugin.php');
wp_die("wp-config.php dosyasinin olup olmadigini kontrol ediniz.");
}
$wp_did_header = true;
require_once( dirname(__FILE__) . '/wp-config.php');
wp();
gzip_compression();
require_once(ABSPATH . WPINC . '/template-loader.php');
endif;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
******<title>İmc Tv Yandex Rss</title>
******<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
******<meta http-equiv="Content-Language" content="tr" />
</head>
*
<body>
<?php
$data = '<?xml version="1.0" encoding="utf-8"?>';
$data .= "\n".'<rss version="2.0" xmlns="http://backend.userland.com/rss2" xmlns:yandex="http://haber.yandex.com.tr"';
$data .= "\n".'xmlns:media="http://search.yahoo.com/mrss/">';
$data .= "\n<channel>";
$data .= "\n<title>İmctv</title> ";
$data .= "\n<link>http://www.imctv.org</link> ";
$data .= "\n<description>imctv, haber, spor, magazin, teknoloji gibi alanlarda internetin hızlı ve etkileyici değişimini uluslararası boyutta takip eden bir medya ekibidir. İmctv Türkiye ve dünya ile ilgili gündem başlıklarını ziyaretçilerine ileten başlıca haber kaynağıdır. İmctv kollektif, bağımsız ve açık sözlü tarzıyla, Sosyal Medya ekibini oluşturmuştur. Ticari faaliyetlerinin tamamını kendi bünyesinde sürdürmektedir.</description> ";
$data .= "\n<image> ";
$data .= "\n<url>http://www.imctv.org/wp-content/themes/wpmedyahaber/images/logo.png</url>";
$data .= "\n<title>İmcTv</title> ";
$data .= "\n<link>http://www.imctv.org</link>";
$data .= "\n</image> ";
*
function filter_where($where = '') {
*****$where .= " AND post_date > '" . date('Y-m-d', strtotime('-7 days')) . "'";
*****return $where;
*****}
add_filter('posts_where', 'filter_where');
*
query_posts( 'posts_per_page=1000&cat=5,13,6,8,9221,7,422,9,1491,10,1338,12&orderby=date' );
*
if (have_posts()) : while (have_posts()) : the_post();
$category = get_the_category();
$content = get_the_content_feed('rss2');
$title = get_the_title($post->post_parent);
if ( $parent_title != the_title(' ', ' ', false) ) {
}
$page_id = get_post( $id );
$link = get_permalink( $page_id );
$desc = substr(esc_textarea( strip_tags( $content ) ),0,150)."...";
$data .= "\n<item>
<title>".$title."</title>
<link>".$link."</link>
<description>".esc_textarea( strip_tags( $desc ) )."</description>
<author>".the_author()."</author>
<category>".$category[0]->cat_name."</category>
<enclosure url=\"".wp_get_attachment_url( get_post_thumbnail_id($post->ID) )."\" type=\"image/jpeg\"/>
<pubDate>".mysql2date('D, d M Y H:i:s +0300', get_post_time('Y-m-d H:i:s', true), false)."</pubDate>
<yandex:genre>message</yandex:genre>
<yandex:full-text>".esc_textarea( strip_tags( $content ) )."</yandex:full-text>
</item>";
*
endwhile;else : endif;
*
$data .= "\n</channel>
</rss>";
*
$file = 'yandex.xml';
$fp = fopen($file, "w");
********if($fp){
************fwrite($fp, $data);
************fclose($fp);
********}*
?>
</body>
</html> hocam deşiklikleride yaptım ama yine olmadı bir bakarmısın nerede yanlışlık yaptım acaba.