Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Kupası
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPress’te Her Özel Yazı Türü İçin Ayrı Bir RSS Akışı Oluşturma

Editoryal Not: WPBeginner üzerindeki ortak bağlantılardan komisyon kazanıyoruz. Komisyonlar, editörlerimizin görüşlerini veya değerlendirmelerini etkilemez. Editoryal Süreç hakkında daha fazla bilgi edinin.

WordPress web sitenizdeki her özel yazı türü için ayrı bir RSS beslemesi mi yapmak istiyorsunuz?

Özel gönderi türleri, web sitesi sahiplerinin kendi benzersiz içerik türlerini eklemelerine olanak tanır. Bu gönderi türleri, RSS beslemesi de dahil olmak üzere gönderilere veya sayfalara benzer özelliklere sahip olabilir.

Bu makalede, WordPress’te özel yazı türleri için nasıl kolayca ayrı bir RSS beslemesi yapabileceğinizi göstereceğiz.

Making RSS feed for custom post types in WordPress

WordPress’te Özel Yazı Türleri için Ayrı RSS Beslemeleri Oluşturma

WordPress varsayılan olarak web siteniz için birkaç RSS beslemesi oluşturur.

Örneğin, son blog yazılarınızın tümü sitenizin ana RSS beslemesinde görünür. Bu beslemeye, alan adınıza aşağıdaki gibi /feed/ ekleyerek erişebilirsiniz:

https://example.com/feed/

Yeni başlayanların çoğunun bilmediği şey, WordPress’in web sitelerinin farklı arşiv sayfaları için ayrı RSS beslemeleri oluşturduğudur.

Örneğin, kategoriler, etiketler, yazarlar ve özel gönderi türleri için ayrı RSS beslemeleri vardır.

Diyelim ki web sitenizde filmler adında özel bir gönderi türünüz var. Yazı türü arşivi sayfasını ziyaret ederek bu yazı türünde oluşturulan tüm içeriği görüntüleyebilirsiniz:

https://example.com/movies

Example of a custom post type archive page

RSS beslemesini görüntülemek için özel gönderi türü arşiv URL’sinin yanına /feed/ eklemeniz yeterlidir.

https://example.com/movies/feed/

Custom post type RSS feed in WordPress

Alternatif olarak, ana WordPress RSS beslemenize gönderi türü parametresini ekleyerek beslemeyi görüntüleyebilirsiniz. Örneğin:

https://example.com/feed/?post_type=movies

Bu URL daha sonra yalnızca movies adlı özel gönderi türünü getirecektir.

Alternate custom post type RSS feed URL

Özel Yazı Tipi RSS Akışına Bağlantı Ekleme

Artık WordPress web sitenizdeki herhangi bir özel yazı türü için RSS beslemelerine nasıl erişeceğinizi bildiğinize göre, özel yazı türü beslemelerinize bağlantılar oluşturmak için bu URL’yi kullanabilirsiniz.

Örneğin, ziyaretçilerinizin bu gönderilere kolayca abone olabilmesi için özel gönderi türü arşiv sayfasında bir simge veya düz metin bağlantısı görüntülemek isteyebilirsiniz.

1. Blok Temalarında Özel Yazı Tipi RSS Akışına Bağlantı Ekleme

Tam site düzenleme desteğine sahip bir blok teması kullanıyorsanız, bağlantıyı şu şekilde ekleyeceksiniz.

Öncelikle, WPCode eklentisini kullanarak WordPress web sitenize özel bir kod parçacığı eklemeniz gerekir.

Not: Bu kod parçacığını eklemek için kullanabileceğiniz WPCode’un ücretsiz bir sürümü de vardır.

Öncelikle WPCode eklentisini kurup etkinleştirmeniz ve ardından Code Snippets ” + Add New Snippet sayfasına gitmeniz gerekir.

Add new snippet

Buradan, ‘Özel Kodunuzu Ekleyin (Yeni Snippet)’ seçeneğinin altındaki ‘Snippet Kullan’ düğmesine tıklayın.

Bir sonraki ekranda, kod parçacığınız için bir ad girin. Bu, kod parçacığını tanımlamanıza yardımcı olacak herhangi bir şey olabilir. Bundan sonra, Kod Türü altında ‘PHP Snippet’i seçin.

Son olarak, Kod Önizleme kutusuna aşağıdaki kodu ekleyin:

    if (is_post_type_archive('movies')) {
            $post_type = get_queried_object();
            // Get RSS Feed URL
            $rss_feed_url = get_post_type_archive_feed_link($post_type->name);
            // Output the shortcode content
            return '<p>Subscribe to <a href="' . esc_url($rss_feed_url) . '">' . $post_type->label . '</a></p>';
        }
    }
// Register the shortcode
add_shortcode('custom_post_type_rss_link', 'custom_post_type_rss_link_shortcode');

‘movies’ yerine kendi özel gönderi türünüzün adını yazmayı unutmayın.

İşte WPCode eklentisinde bir snippet olarak nasıl görüneceği:

Adding custom code for RSS feed link

Şimdi ‘Etkin’ anahtarını açın ve snippet’inizi ‘Kaydet/Güncelle’.

Bu kod, bir kullanıcının belirli bir özel gönderi türü arşiv sayfasını görüntüleyip görüntülemediğini otomatik olarak algılar ve ardından abone olmak için bir bağlantı görüntüler.

Ardından, bağlantıyı görüntülemek için blok temanızda veya widget’larınızda kullanabileceğiniz bir kısa kod oluşturur.

Ardından, site düzenleyicisini başlatmak için Görünüm ” Düzen leyici sayfasını ziyaret etmeniz gerekir. Bundan sonra, sol menüden Şablonlar ” Arşiv seçeneğini seçin.

Edit Archive template in Site Editor

Ardından, RSS besleme bağlantısını görüntülemek istediğiniz yere Kısa Kod bloğunu ekleyin.

İdeal olarak, bunu en üstte Arşiv Adının hemen altında göstermek istersiniz.

Add shortcode block

Kısa kod bloğunun içine aşağıdaki kısa kodu eklemeniz gerekir:

[custom_post_type_rss_link]

Bundan sonra, değişikliklerinizi kaydetmeyi unutmayın.

Artık RSS besleme bağlantısını çalışırken görüntülemek için özel gönderi türü arşiv sayfanızı ziyaret edebilirsiniz.

RSS feed link preview

2. Klasik Temalarda Özel Yazı Tipi RSS Akışına Bağlantı Ekleme

Bunu yapmanın en kolay yolu, WordPress temanızda özel gönderi türünüz için ayrı bir şablon oluşturmaktır.

Bir FTP istemcisi kullanarak WordPress web sitenize bağlanın ve /wp-content/themes/your-current-theme/ klasörüne gidin.

Şimdi, özel gönderi türünüzün adı movies ise, WordPress tema klasörünüzde bir archive-{post_type}.php dosyası oluşturabilirsiniz.

Bundan sonra, temanızın archive.php şablonundaki içeriği kopyalayabilir ve yeni şablonunuzu özelleştirmeye başlayabilirsiniz.

Aşağıdaki kodu kullanarak gönderi türü arşiv beslemenize düz bir HTML bağlantısı ekleyebilirsiniz:

<p><strong>Subscribe to: <a href="https://example.com/movies/feed/">Movies</a></strong></p>

URL’yi gönderi türü besleme URL’niz olarak değiştirmeyi unutmayın.

Şimdi, bu kodla ilgili sorun, yalnızca söz konusu gönderi türü için yeni bir şablon dosyası oluşturmanız gerekecek olmasıdır.

Bir sonraki yöntem, tüm arşiv sayfalarınız için gönderi türü RSS besleme bağlantısını dinamik olarak oluşturmanızı sağlayacaktır.

Aşağıdaki kodu temanızın archive.php şablon dosyasına eklemeniz yeterlidir.

<?php if ( is_post_type_archive() ) { 
$post_type = get_post_type( get_queried_object_id() );?> 
				<p><strong>Subscribe to: <a href="<?php echo get_post_type_archive_link( $post_type  ); ?>feed/"><?php post_type_archive_title(); ?></a></strong></p>
<?php } ?>		

Bu kod, yazı türünün arşiv sayfası başlığının altına bir bağlantı ekleyerek kullanıcıları bu belirli içerik türüne abone olmaya teşvik eder.

Bonus İpucu: Ana RSS Akışınıza Özel Gönderi Türü Ekleyin

Özel yazı tipi RSS beslemeleri, besleme okuyucular tarafından kolayca bulunamaz ve kullanıcılarınızın çoğu sitenizin RSS beslemesini daha kolay bulabilir.

Bu, ana RSS beslemenize abone olan kullanıcıların özel gönderi türünüzde yayınladığınız içeriği kaçıracağı anlamına gelir.

Sitenizin ana RSS beslemesinde görünmesi için özel gönderi türünüzden içerik ekleyerek bunu kolayca düzeltebilirsiniz.

Bunu yapmak için WordPress blogunuza özel bir kod parçacığı eklemeniz gerekecektir. WordPress’e özel kod parçacıkları eklemek için WPCode kullanmanızı öneririz.

Öncelikle, ücretsiz WPCode eklentisini yüklemeniz ve etkinleştirmeniz gerekir. Daha fazla ayrıntı için WordPress eklentisinin nasıl kurulacağına ilişkin makalemize bakın.

Eklenti etkinleştirildikten sonra, WordPress yönetici kenar çubuğundan Code Snippets ” + Add Snippet sayfasını ziyaret edin.

Buradan, ‘Özel Kodunuzu Ekleyin (Yeni Snippet)’ seçeneğinin altındaki ‘Snippet Kullan’ düğmesine tıklamanız gerekir.

Add new snippet

Şimdi kod parçacığınız için bir ad yazarak başlayabileceğiniz ‘Özel Snippet Oluştur’ sayfasına yönlendirileceksiniz.

Bu isim hiçbir yerde gösterilmeyecek ve sadece tanımlama amacıyla kullanılacaktır.

Ardından, sağdaki ‘Kod Türü’ açılır menüsünden ‘PHP Snippet’ seçeneğini seçin.

Snippet title and code type

Bundan sonra, özel kod parçacığınızı eklemeye hazırsınız.

Aşağıdaki kodu kopyalayıp Kod Önizleme kutusuna yapıştırmanız yeterlidir:

function myfeed_request($qv) {
    if (isset($qv['feed']) && !isset($qv['post_type']))
        $qv['post_type'] = array('post', 'movies', 'books');
    return $qv;
}
add_filter('request', 'myfeed_request');

Kodu ekledikten sonra, kodda ‘[‘post_type’]’ yazan yerin yanına özel gönderi türünün adını yazın. Bizim örneğimizde ‘post’, ‘movies’ ve ‘books’ var.

Bu özel gönderi türü ana WordPress RSS beslemenize eklenecektir.

Add code snippet

Ardından, sayfanın en üstüne geri dönmeniz ve ‘Etkin Değil’ anahtarını ‘Etkin’ olarak değiştirmeniz gerekir.

Son olarak, kodu kaydetmek ve WordPress web sitenizde çalıştırmak için ‘Snippet’i Kaydet’ düğmesine tıklamayı unutmayın.

Save snippet

Hepsi bu kadar, özel gönderi türü içeriğiniz artık sitenizin ana RSS beslemesine eklenecektir.

Bu makalenin WordPress’te özel yazı türleri için ayrı bir RSS beslemesinin nasıl oluşturulacağını öğrenmenize yardımcı olduğunu umuyoruz. WordPress RSS beslemelerinizi optimize etme hakkındaki eğitimimize ve en iyi WordPress RSS eklentileri için uzman seçimlerimize de göz atmak isteyebilirsiniz.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Açıklama: İçeriğimiz okuyucu desteklidir. Bu, bazı bağlantılarımıza tıklarsanız komisyon kazanabileceğimiz anlamına gelir. WPBeginner'ın nasıl finanse edildiğini, neden önemli olduğunu ve nasıl destek olabileceğinizi görün. İşte editoryal sürecimiz.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Ultimate WordPress Araç Kiti

Araç setimize ÜCRETSİZ erişim sağlayın - her profesyonelin sahip olması gereken WordPress ile ilgili ürün ve kaynaklardan oluşan bir koleksiyon!

Reader Interactions

30 yorumBir Cevap Bırakın

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Buddika Wijerathena says

    Is there way to create RSS feed for single page ?
    Ex – example.com/single-post-type/single-post-name

    How to create RSS for this ?

    • WPBeginner Support says

      RSS feeds are for listing multiple posts, the RSS would include a link to the post itself. We would not recommend creating a specific RSS feed for one post or page.

      Yönetici

  3. Milan says

    Hey, and do you know any rss wordpress plugin for visitors ? As big new companies have own RSS creator to put rss on some freelancer sites, I want to it same, but not with post but with custom post types….do you know some RSS plugin ?

  4. Tori says

    It still doesn’t work for me – I’m trying to display an RSS Feed for the content on this page –

    and displays the RSS feed for all of my posts. Any thoughts?

      • Tori says

        Thank you for the response. I’m sorry for the confusion as it looks like my links didn’t appear. The posts that appear on that page are custom posts (it’s like the blog roll but for custom posts), but the method to do the RSS feed didn’t work for me. Any thoughts or suggestions?

        • WPBeginner Support says

          Hey Tori,

          If you are certain that the posts belong to a custom post type, then you need to find out the name used by the custom post type. You can do that by clicking on the custom post type menu item in your WordPress admin sidebar. Clicking on it will take you to an admin page listing all the posts in that post type. Now if you look into the browser address bar you will see something like this:

          http://www.example.com/wp-admin/edit.php?post_type=your_post_type

          The part that appears after the post_type= is your custom post type name. Now you need to use this to reach the RSS feed URL for that custom post type.

          http://www.example.com/feed/?post_type=your_post_type

          Hope this helps.

    • Tori says

      Thank you for the response. When I do that, I see this error message — any thoughts?

      ______

      This page contains the following errors:

      error on line 2 at column 1: Extra content at the end of the document
      Below is a rendering of the page up to the first error.

  5. Cédric Charles says

    Hi and thanks for this !

    I would like to add custom fields for my custom post type feed (not for the regular posts, only for my custom post type).

    How could I do that ?

    Thanks a lot !

  6. mike says

    I’ve gotten this to work but it limits the posts in the rss feed to 10 when I feedburn it. Is there any way to create a full rss feed for custom post types without limiting the quantity of posts it pulls in?

  7. Andrew says

    Hi there. Could you tell me how to create a feed for all post types, so someone can signup to a single RSS feed for all posts on the site, regardless of which post type they are in?

  8. Rems says

    THANK YOU VERY MUCH, i was looking for this info for 2 hours. Glad i found your info. Fu…. taxonomy, where were you?!! aahhh!
    Work so fine now

  9. AlexAmelines says

    it works for me and I love you for it. I created a link to each pos type I’ve got, but in the RSS reader they are all called the same, any way I can affect the title of the feed to reflect the post type?

  10. Alan says

    If I am using a slug re-write for the taxonomy that wouldn’t make a difference and be causing the problem would it? I’ve tried both ways and it doesn’t work either way, with the actual registered taxonomy title or the slug.

  11. Aldi says

    I can’t seem to make that work. It only takes me back to the custom post type archive page again.

    Btw, I use Custom Post Permalinks plugin to allow custom post type permalinks and archive pages. Could that have created the issue??

    Cheers!

    • Aldi says

      Oops, sorry.. it was my theme’s problem. I had an action call to redirect anything that is related to custom post types, thus the redirection of the feeds. But got it fixed now.

Bir Cevap Bırakın

Yorum bırakmayı seçtiğiniz için teşekkür ederiz. Lütfen tüm yorumların yorum poli̇ti̇kasi uyarınca denetlendiğini ve e-posta adresinizin yayımlanmayacağını unutmayın. Ad alanında anahtar kelime KULLANMAYIN. Kişisel ve anlamlı bir sohbet edelim.