0

I created a custom template with its own custom query. Use case: a page for just sticky posts.

Added sticky.php to the theme with

/**
 * Template Name: Sticky
 */

and the following loop:

$query = new WP_Query(array('post__in' => get_option( 'sticky_posts' ), 'posts_per_page'=>10, 'ignore_sticky_posts'=>1, 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ) ));
if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
get_template_part('excerpt'); 
endwhile; endif;

Next, I add an empty page called Sticky with sticky.php as template.

Now, when I go to example.com/sticky, the selection works fine, pagination included. However, example.com/sticky/feed doesn't show a proper feed, instead it has an empty comments feed, as if it were a post.

So what should I do to have it output a feed of posts, like all other archive pages do?

1 Answer 1

1

Start with adding your new feed name and custom function through add_feed, then dont't forget to flush rewrite rules (just once).

You can find several WordPress functions that will help your formatting the Feed XML.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.