Support » Fixing WordPress » How can I add the pages to my RSS feed?

  • Resolved svedish

    (@svedish)


    Hi guys,

    I hope someone will be able to help me with a simple question (not so simple for me obviously!).

    One of my websites is made of pages and posts as well. I use pages for static longer articles and posts for short news and I’m happy with the structure of it so that’s not going to change.

    Now, I’d be great if the people and websites that are subscribed to my RSS feed could receive updates also when I write a new article (page). Can anyone please tell me how to achieve this? I’d like to either include the pages feed inside the main feed or create another pages feed. The first option would be better to be honest so I have one big feed for everything.

    I’d also like to stay away from plugins if possible. Can anyone suggest something that could be achieved, for example, in the functions file or any other part of the code?

    Big thanks! 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • If you want multiple feeds –

    http://yourdomain.com/feed/ (will show only posts)
    http://yourdomain.com/feed/?post_type=page (will show only pages)

    If you want one condensed feed –

    Add this to your functions.php file –

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

    now this is your feed URL –

    http://yourdomain.com/feed/ (will show both posts and pages)

    Thread Starter svedish

    (@svedish)

    Genius! Thanks.

    I hate the idea of using addons for every little thing. I’ll see how this works out. And also thanks for pointing out how the query in the URL works. Basically the feature is already there. At the end of the day pages are posts types! That’s right. 🙂

    Thanks again, really appreciated.

    Thread Starter svedish

    (@svedish)

    By the way, a slightly unrelated question. Adding the pages to the feed exposed a page (friends links) where I have added links to directories and stuff like that. I really wanted to keep this page hidden from Google. Is there any way to exclude this page from the feed? Or is it maybe better to use a different template for it and maybe use a robots noindex tag in it?

    Thanks a lot.

    Adding ‘noindex’ should work, but it is of course a pain to have to have two separate templates. I can’t think of a way of doing it through the request action off the top of my head, but it is a good question and I may well have to research that a little.

    One thought – add a filter to your header.php file for the re event text and then just alter it through the filter on the pages where you don’t want Google to index them? Hope that makes sense!

    Thread Starter svedish

    (@svedish)

    Hello,

    thanks for your answer and sorry, no, I’m not sure I understand what you mean re: the filter in the header.php. Soz 🙂

    Ok, Im on my tab with no code at the mo, I’ll try and take 5 to post a quick example when I’m in the office tomorrow – it should hopefully be pretty straight forward!

    Thread Starter svedish

    (@svedish)

    hi Duck Boy, that’s very kind. Cheers 🙂

    Hmm, it looks easier than I first though…

    add this to your functions.php file –

    function make_page_noindex(){
    	echo '<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">';
    }

    and this to your page.php file just above get_header(); (or what ever template you want it in, obviously changing 69 for your desired page ID) –

    if(is_page(69)) :
    	add_action('wp_head', 'make_page_noindex');
    {
    endif;
    Thread Starter svedish

    (@svedish)

    You’re absolutely right! Thanks a lot. Take care. 🙂

    You are welcome – and could you please mark this thread as ‘Resolved’ on the right.

    Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How can I add the pages to my RSS feed?’ is closed to new replies.