0

I have been trying to create URL feed for all child pages of a parent page. Those child pages have featured image and excerpt info (+author, published date)

I found here that is possible to create URL feed for just displaying only pages, but i would like that only from a specific page the child pages, going one level deep to one specific page.

I have been searching to find maybe a template that could loop the child pages of a parent page to combine with this tutorial , but with no luck.

Any help would be appreciated.


UPDATE: I did something like this

add_action( 'pre_get_posts', 'shows_in_feed' );
function shows_in_feed( &$query )
{
  if ( isset ( $_GET['post_type'] ) && $_GET['post_type'] === 'shows' && 
  is_feed() )
{

           $query->set( 'post_type', 'page' );
           $query->set( 'post_parent', '1602' ); 
   }
}     

for giving me in return under /feed/?post_type=shows all the children pages of page with ID 1602. And it works. But how can i get the most recent published pages in the feed? Is my code correct?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.