WordPress.org

Ready to get started?Download WordPress

Forums

homepage multi-loops (2 posts)

  1. tdblanchard
    Member
    Posted 6 years ago #

    Hey gang,
    I'm trying to customize a WP installation for a pro-bono client and had a question about my one-off homepage...
    What I'm trying to do is display the most recent post (1 only), followed by the title and content of a "page".
    I had installed the "Get-A-Post" plug-in, but it turned out to be the culprit in crashing my admin section whenever i would edit anything!
    here's the code I have so far:

    <div id="inside_content">
    				<h1>Alice's Blog</h1>
    				<?php
    				$postslist = get_posts('numberposts=1');
    				foreach ($postslist as $post) :
    				setup_postdata($post);
    				?>
    					<div class="entry">
    					<h2 class="post_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    					<?php the_content(); ?>
    					<?php the_date(); ?>
    					</div>
    				<?php endforeach; ?>
    				<?php get_a_post(5); ?>
    					<div class="entry">
    					<h2><?php the_title(); ?></h2>
    					<?php the_content(); ?>
    					</div>
    				</div><!-- /#inside_content -->
  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    What's wrong with get_post and get_page?

    $mypage = get_page(5);
    setup_postdata($mypage);
    <div class="entry">
    <h2><?php the_title(); ?></h2>
    <?php the_content(); ?>
    </div>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.