• Hey guys,

    The following code allows me to display pages instead of posts:
    <?php query_posts('post_type=page'); ?>

    But, with this i cant find a way to display blog posts on a page template.

    Can anyone help me out?

    thanks in advance
    christian

Viewing 1 replies (of 1 total)
  • Thread Starter p2or

    (@p2or)

    <!-- get pagetitle -->
    	<?php $page_title = $wp_query->post->post_title; ?>
    	<?php echo ($page_title) ?>
    
    	<!-- if pagename is X - blog loop -->
    	<?php if ($page_title == 'sasadda'){
    
    		$temp = $wp_query;
    		$wp_query= null;
    		$wp_query = new WP_Query();
    		$wp_query->query('posts_per_page=7'.'&paged='.$paged);
    		while ($wp_query->have_posts()) : $wp_query->the_post();?>
    
    		<h1><?php the_title(); ?></h1>
    		<?php the_content(); ?>
    		<?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'boilerplate' ), 'after' => '' ) ); ?>
    		<?php edit_post_link( __( 'Edit', 'boilerplate' ), '', '' ); ?>
    
    		<?php comments_template( '', true ); ?>
    
    		<?php endwhile;
    
    		$wp_query = null; $wp_query = $temp;
    
    	}
    	?>

    I fixed it with a simple statement in the main loop, but is there a more elegant/dynamic way to use this in a page template?

    thanks

Viewing 1 replies (of 1 total)
  • The topic ‘all pages on front page and blog posts on page template’ is closed to new replies.