Skip to content

Instantly share code, notes, and snippets.

@siripuramrk
Forked from thefuxia/t5-page-feed.php
Created February 25, 2013 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siripuramrk/5031674 to your computer and use it in GitHub Desktop.
Save siripuramrk/5031674 to your computer and use it in GitHub Desktop.
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Page Feed
* Description: Adds a feed for pages at <code>/feed/?post_type=page</code>.
* Version: 2012.05.22
* Author: Thomas Scholz
* Author URI: http://toscho.de
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
add_action( 'pre_get_posts', 't5_pages_in_feed' );
/**
* Set post type to 'page' if it was requested.
*
* @param object $query
* @return void
*/
function t5_pages_in_feed( &$query )
{
if ( isset ( $_GET['post_type'] ) && $_GET['post_type'] === 'page' && is_feed() )
{
$query->set( 'post_type', 'page' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment