• Resolved matthisco

    (@matthisco)


    Hi Folks,

    My page of posts is an empty white space. I’ve set it as a template for my news page and added a few posts, here is my code. Can anyone help?

    <?php
    /*
    Template Name: News template
    */
    
    // if you are not using this in a child of Twenty Eleven, you need to replicate the html structure of your own theme.
    
    get_header(); ?>
    
    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'category_name' => 'Latest News', // Change these category SLUGS to suit your use.
    	'paged' => $paged
    );
    query_posts($args);
    if( have_posts() ) :?>
    
    <?php twentyeleven_content_nav( 'nav-above' );?>
    
    <?php while ( have_posts() ) : the_post(); ?>
    
    <?php get_template_part( 'content', get_post_format() ); ?>
    
    <?php endwhile; ?>
    
    <?php twentyeleven_content_nav( 'nav-below' ); ?>
    
    <?php else : ?>
    <?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
    
    <?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
    <?php get_search_form(); ?>
    
    <?php endif; ?>
    
    <?php $posts = get_posts( "category=3&days=7" ); ?>
    <?php if( $posts ) : ?>
    
    <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
    
    <a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
    <?php endforeach; ?>
    
    <?php endif; ?>
    <?php get_footer(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Page of posts – no posts, using modified wordpress theme’ is closed to new replies.