Post-Format-specific template

Good morning;
I´m trying to create a blog template to show only one category using a child theme of sparkling, and using this code:

<?php query_posts(‘category_name=projects’); ?>

but when i create a page whith this template, the pager doesn’t work. It shows only the first page posts, not the rest.

Do I have to create another template "content-____ .php or similar?


This is the code i created:


  • Template Name: Entradas documentos

get_header(); ?>

&lt;div id="primary" class="content-area"&gt;
	&lt;main id="main" class="site-main" role="main"&gt;

	&lt;!-- Filtramos por categoría "documentos" --&gt;
	&lt;?php query_posts('category_name=documentos'); ?&gt;
	&lt;?php if ( have_posts() ) : ?&gt;

		&lt;?php /* Start the Loop */ ?&gt;
		&lt;?php while ( have_posts() ) : the_post(); ?&gt;

				/* Include the Post-Format-specific template for the content.
				 * If you want to override this in a child theme, then include a file
				 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
				get_template_part( 'content', get_post_format() );

		&lt;?php endwhile; ?&gt;

		&lt;?php sparkling_paging_nav(); ?&gt;

	&lt;?php else : ?&gt;

		&lt;?php get_template_part( 'content', 'none' ); ?&gt;

	&lt;?php endif; ?&gt;

	&lt;/main&gt;&lt;!-- #main --&gt;
&lt;/div&gt;&lt;!-- #primary --&gt;

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Hi @alpaezes,

I hope you are well today and thank you for your question.

Could you please try using the updated template file attached to this reply that contains the following modified snippet of code.


$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

query_posts('category_name=documentos&paged=' . $paged); 


The attached template file is working fine on my test site.

Best Regards,