Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have the following problem: I have to create a posts archive into a static page. So I have created this page template containing the loop to interate on my posts:

<?php

/**
 * Template Name: Posts Archive
 *
 * A custom page template for displaying all posts.
 *
 * The "Template Name:" bit above allows this to be selectable
 * from a dropdown menu on the edit page screen.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header();
?>

<!-- Contenuti (griglia) -->
<div class="container">
    <!-- Lead presentazione -->
    <section id="presentazione">
        <div class="row">
            <div class="col-sm-12">
                <!--<h1 class="text-center"><small>Associazione per la Tutela dei Diritti Umani del Popolo Eritreo</small></h1>-->
                <h1 class="text-center title">Associazione per la Tutela dei Diritti Umani del Popolo Eritreo</h1>
                <h1 class="text-center leadTitle">Association in Defense of the Human Rights of the Eritrean People</h1>
                <!--
                <p class="lead text-center">
                Association in Defense of the Human Rights of the Eritrean People
                </p>
                -->
            </div><!-- /.col-sm-12 -->
        </div><!-- /.row -->
    </section><!-- /section presentazione -->
    <!-- Progetti in evidenza -->

    <header class="header-sezione">
        <h2>Archivio post</h2>
    </header>


    <?php
    if (have_posts()) :
        // Start the Loop.
        while (have_posts()) : the_post();

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

        endwhile;
    else :
        // If no content, include the "No posts found" template.
        get_template_part('content', 'none');

    endif;
    ?>

    </section>
</div>

<?php get_footer(); ?>

Thene I then created a new page using the Wordpress Admin system with a title of "All Posts" and selected the "All Posts" template from the drop-down. Didn't need to enter anything in the body.

If you open this link you can see my problem: http://lnx.asper-eritrea.com/archivio/

The problem is that it don't show the posts list but this list contains only a single element that is the current page.

It seems to me (correct me if I am saying wrong things) that if I insert a loop into a static page the iterated list is not a list of post but a list that contains the current static page referer? Is it true?

So what can I do to obtain the entire posts list into a static page? Have I to specify a new query? Or what? How can I do it?

Tnx

share|improve this question
    
What is the code on contentArchive.php file ? –  Shazzad Aug 12 at 18:03
    
you need to add a suitable query to tell the loop what you are trying to show; review the second custom loop in codex.wordpress.org/Page_Templates#A_Page_of_Posts –  Michael Aug 12 at 18:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.