[resolved] Custom Page of Posts template problem (4 posts)

  1. awa4000
    Posted 3 years ago #

    This should be a really easy fix...

    I created a custom page template using the code provided at under the 'A Page of Posts' heading. I succeeded in my goal of creating a page that only displays posts from one category but now the content is not floating next to the sidebar but pushed below it.

    The URL is .
    I am using the twenty-eleven theme.
    The posts are published under the default post type.
    And here is the code I copied and amended:

    Template Name: Page Of Posts
    /* if you are not using this in a child of Twenty Eleven,
    *  you need to replicate the html structure of your own theme.
    <div id="primary">
      <div id="content" role="main">
      /* the_post will retrieve the content of the new page you
      *  create to list the posts, e.g. as an intro to describe
      *  which posts are shown.
      // Display content of page
      get_template_part( 'content', get_post_format() );
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
      $args = array(
    	// Change these category SLUGS to suit your use.
    	'category_name' => 'editions',
    	'paged' => $paged
      $list_of_posts = new WP_Query( $args ); 
      twentyeleven_content_nav( 'nav-above' );
      while ( $list_of_posts->have_posts() ): $list_of_posts->the_post();
        // Display content of posts
        get_template_part( 'content', get_post_format() );
      twentyeleven_content_nav( 'nav-below' );
      </div><!-- /#content -->
    </div><!-- /#primary -->
    <?php get_footer();

    Please let me know if there is any more information I need to provide. I think this is a super easy fix but I'm new. Any help is deeply appreciated.

  2. Michael
    Forum Moderator
    Posted 3 years ago #

    hopefully you are doing this all in a child theme; if not, start by creating a child theme; http://codex.wordpress.org/Child_Themes

    then proceed with the 'super easy fix':

    move the location of the 'get_sidebar()' code to just before the line with 'get_footer()';

    then apply the code to functions.php (in the child theme) as described in my article http://www.transformationpowertools.com/wordpress/twenty-eleven-new-page-template-with-sidebar-correction

  3. awa4000
    Posted 3 years ago #

    Alchymyth, thanks a ton man!

  4. awa4000
    Posted 3 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic