How do I display the loop inside a static page? Like the loop when I use the search (which in this theme it's actually working) or on index.php

An example for what I'm saying can be seen here: http://www.gaganews.com.br/noticias/ I want a page like this, showing all my posts with pagination, since my home page is kinda like the homepage here: http://www.gaganews.com.br/

I tried creating a template page, this way:


Template Name: Noticias

get_header(); ?>

<div id="loop"><?php if ( have_posts() ) : ?>
            get_template_part( 'loop', 'index' );
<?php endif; ?>
<div id="sidebar_single"><?php get_sidebar(); ?></div>
<?php get_footer(); ?>

I'm almost 100% sure that it's not the right way, but that's what I tried - like it was a "classic" index.php.

Then I created a blank page with this template, but with it instead of showing the latest posts on the page, it ONLY shows the PAGE TITLE itself: "News, posted on 1 de abril de 2013 by admin | Leave a comment | Edit" etc, but with all the CSS configuration from the loop (which means it's actually calling it, right?).

What could I do to achieve what I'm looking for?

2 Answers 2


You could use query_posts() to set up a new loop in your page. Assuming that the posts you want are in the category 'Noticias', with a slug of 'noticias':

query_posts( 'category=noticias' );
if( have_posts() ) {
    get_template_part( 'loop', 'index' );
wp_reset_query(); // probably not necessary, if you don't have a pre-existing Loop
  • That worked, thank you! I just needed to add an extra parameter (codex.wordpress.org/…) because I wanted pagination and it wasn't working properly (without it, on other pages it would keep displaying the same posts). But that's it. Commented Apr 2, 2013 at 16:30

You can simply use an iframe to wrap your query and place the iframe on any html or php page without having to touch your current page code.... See detail explanation on this link: http://allnigeriansinspain.com/blog/show-wordpress-post-on-static-html-page/

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.