Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter [email protected]

    (@chibiwawagmailcom)

    I tried this and it just brings back errors:

    <?php if (have_posts()) : ?>
    <?php
    // The Query
    $query = new WP_Query( 'posts_per_page=5' );
    
    // The Loop
    while ( $the_query->have_posts() ) : $the_query->the_post();
    	echo '<li>';
    	the_title();
    	echo '</li>';
    endwhile;
    
    // Reset Post Data
    wp_reset_postdata();
    ?>
         <?php endif; ?>
    Thread Starter [email protected]

    (@chibiwawagmailcom)

    I posted this on CSS-Tricks.com and someone said to use this:

    <div class="fourcolumn">
            <h2>Latest Post</h2>
    
            <?php query_posts( 'posts_per_page=1' ); ?>
            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                    <div class="lp-dates"><?php the_time('M <br /> j') ?></div>
    
                    <div class="latest-post"><a href="<?php the_permalink(); ?>"><?php wpe_excerpt('wpe_excerptlength_teaser', 'wpe_excerptmore'); ?></a><div class="dash-divider"></div></div>
            <?php endwhile; ?>
    
            <?php else: ?>
                    <h1>Not Found</h1>  
    
                    <p>Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post</p>
            <?php endif; ?>
    </div>

    It works perfect!

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘How to put Blog Loop on Every Page’ is closed to new replies.