• Resolved chad_coleman

    (@chad_coleman)


    I’ve been using a modified home.php which would show multiple threads of posts from different categories.

    example: the left side would show all posts in the ‘feature’ category, and the right side would show all posts in the ‘web’ category.

    I’m trying to do something new, by showing the contents of a page slugged with ‘home’, but allowing a list of latest posts show from a ‘news and announcements’ sidebar.

    Here is what i’ve been using for showing mulitple categories. Would anyone know what i should use to show a specific page by its id?

    <!-- Begin Feature Story -->
    <?php $posts = get_posts( "category=14&numberposts=1" ); ?>
    <?php if( $posts ) : ?>
    <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
    		<div id="feature">
    
    <h2 class="posttitle">
    <a href="<?php the_permalink() ?>" title="Click to read <?php the_title(); ?>"><?php the_title(); ?></a>
    </h2>
    
    <div class="meta"><span class="left"><?php the_time('F jS, Y') ?> &nbsp;&nbsp;&nbsp;<span class="postcomments"><?php comments_popup_link(__('(0)'), __('(1)'), __('(%)')); ?></span></span> Posted By <?php the_author() ?>.</div>
    
    <div class="postbody"><?php the_excerpt_reloaded(100, '<img><p>', 'none', 'content_rss', 'Read More &raquo;', FALSE); ?></div>
    
    		<?php edit_post_link('Edit this entry','<span class="editentry">','</span>'); ?>
    
    		</div><!-- end feature -->
    
    <?php endforeach; ?>
    <?php endif; ?>
    <!-- End Feature Story -->

    I’m assuming it’s a modification of this call

    <?php $posts = get_posts( "category=14&numberposts=1" ); ?>

    by changing it to

    <?php $posts = get_pages(); ?>

    I’ve managed it to show all pages in a thread. What changes to this ‘get_pages();’ would i make to call a specific page id?

    Thanks for any help.

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

    (@chad_coleman)

    I was able to solve this. Here is the page code I used.

    I used this for home.php. It allows me to edit the home page as a WP Page, as well as have a thread of latest posts showing.

    <?php get_header(); ?>
    
    <div id="content">
      <div id="box-left">
        <!-- Begin Home Page -->
        <?php
    query_posts('page_id=67');  //retrieves home page only by its id of 67
    ?>
        <?php if (have_posts()) : ?>
        <?php while (have_posts()) : the_post(); ?>
        <h1 align="center" style="margin: 0px; padding: 0px;">
          <?php the_title(); ?>
        </h1>
        <?php the_content('Read the rest of this entry &raquo;'); ?>
        <?php edit_post_link('Edit This Page', '<p class="editpost">', '</p>'); ?>
        <?php endwhile; ?>
        <?php else : ?>
        <h2 class="center">Not Found</h2>
        <p class="center">Sorry, but you are looking for something that isn't here.</p>
        <?php include (TEMPLATEPATH . "/searchform.php"); ?>
        <?php endif; ?>
        <!-- End Home Page -->
      </div>
      <div id="box-right">
        <?php get_sidebar(); ?>
      </div>  <!-- end box-right -->
    </div><!-- end content -->
    </div>
    </div>
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Showing Posts and a Page on home.php’ is closed to new replies.