How can I stop repeating the post already declared Feature Posts on Front Page (1 post)

  1. bearded
    Posted 9 years ago #

    I am a novice in Coding Language. I want Feature Posts at my WordPress Front Page. I already have put the display code and its working fine. But the problem is this, that the same Posts repeats on the Front Page with the loop which a different that normal Index pages. Here is the first part of code of my Front Page which displays Feature Posts well: (here Category=13 is my Feature Category)
    <td colspan="3" id="vert" style="border: 1px solid #CCCCCC;">

    <table width="100%" border="0" bgcolor="#F3F7F8">

    <tr><td width="90" height="90" valign="top">
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/exclusive.gif" align="left" alt="Exclusive" border="0">
    <td halign="middle">
    <?php $feature_post = get_posts( 'category=13&numberposts=3' ); ?>
    <?php if( $feature_post ) : ?>
    <?php foreach( $feature_post as $post ) : setup_postdata( $post ); ?>
    <?php $feature_post_id = $post->ID; ?>
    " rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><font size=3 color=red><?php the_title(); ?></font></td></tr>

    <tr><td colspan="2" valign="top">
    <div class="horz">
    <?php the_content('..details..'); ?> </div>
    <?php endforeach; ?>
    <?php endif; ?> </td></tr></table>


    This is the Normal Loop which repeats the Featured Posts in different categories :
    <td colspan="3">
    <table width="100%" cellspacing="0" cellpadding="0">
    <? $kategori = 3; while ( $kategori < ($totalkategori) ) { $kategori++; ?>
    <td id="vert">
    "><img src="<?php bloginfo('stylesheet_directory'); ?>/images/<?php echo "$kategori" ?>.jpg" border="0" alt="More Similar Articles..">
    <td id="vert">
    <?php $posts = get_posts( "category=$kategori&numberposts=1" ); ?>

    <?php if( $posts ) : ?>
    <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>

    <div class="post" id="post-<?php the_ID(); ?>">
    " rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><h2><?php the_title(); ?></h2>
    <?php the_content('<i>..read more »</i>'); ?>
    <?php endforeach; ?>
    <?php endif; ?>
    <?php } ?>

    I am sorry for these above bulky entries!
    Can any body help me that what a piece of code can be added in the 2nd Part of code which could block the Feature posts repeat and force 1 offset post in different categories?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.