WordPress.org

Ready to get started?Download WordPress

Forums

Featured Posts, Two Column Content, and 1 Category Only On The Home Page (1 post)

  1. joeldrapper
    Member
    Posted 5 years ago #

    I have a few questions about a new theme that I am making.

    1. I am using the following code to have a featured post appear at the top of my home page by getting the latest from a category called Featured. How can I stop the same post appearing later on in my page? Or should I just wait for the sticky feature on the new wordpress 2.7?

    The code:
    <?php $featuredposts = get_posts( "category=63&numberposts=1" ); ?> <?php if( $featuredposts ) : ?> <?php foreach( $featuredposts as $featuredpost ) : setup_postdata( $featuredpost ); ?><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img style="border:1px; border-style:solid; border-color:black;" src="<?php echo get_post_meta($featuredpost->ID, 'pft_widescreen', true); ?>" /></a> <h2><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> <?php the_excerpt("Continue reading '" . the_title('', '', false) . "'"); ?> <?php endforeach; ?> <?php endif; ?>

    2. I would like to use a similar function as the code above to show only posts from a certain category on the rest of my home page, however I am also using the method mentioned here to make two columns of content for the un "featured" posts. How can I combine the two so that only posts from a certain category show up?

    Thank you so much in advance!

    Joel

Topic Closed

This topic has been closed to new replies.

About this Topic