2012-12-03 61 views
1

我想包括每個帖子到我的WordPress上的索引頁面,並讓他們每個人都與包含的CSS樣式。我可以查詢所有帖子,並讓它們顯示出來,但只有第一篇文章是實際設計的。其餘的繼承基礎h1,h2,p和其他通用樣式,但它們不是繼承每個「box」類。所有的信息都被扔進一個「盒子」類,而不是像我希望的那樣爲每篇文章啓動一個新的「盒子」類。任何幫助,將不勝感激。WordPress的查詢帖子顯示全部&樣式每一個

這裏是我的代碼,我使用

<?php get_header(); ?> 

    <div id="index-float-left"> 

<div class="box"> 

<?php query_posts('showposts=-1'); ?> 

<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> 

     <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1> 

     <p><?php the_content(); ?></p> 

     <p class="post-date"><?php echo $post_date = get_the_date(); ?></p> 

    </div> 

</div> <!-- END BOX --> 

    </div> <!-- FLOAT BOX BOX --> 


    <?php endwhile; ?> 

<?php else : ?> 

    <h2>Not Found</h2> 

<?php endif; ?> 

<?php get_sidebar(); ?> 

    <?php get_footer(); ?> 

回答

0

沒有與 「末端箱」 和 「FLOAD箱體Box」 的問題。你可以嘗試這樣的:

<?php get_header(); ?> 

<div id="index-float-left"> 

<?php query_posts('showposts=-1'); ?> 

<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 

<div class="box"> 
    <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> 
     <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1> 
     <p><?php the_content(); ?></p> 
     <p class="post-date"><?php echo $post_date = get_the_date(); ?></p> 
    </div> 
</div> <!-- END BOX --> 

<?php endwhile; ?> 
<?php else : ?> 

    <h2>Not Found</h2> 

<?php endif; ?> 

</div> <!-- FLOAT BOX BOX --> 

<?php get_sidebar(); ?> 
+0

它仍然將所有的內容中的一個「盒子」 –

+0

這做到了!非常感謝您的幫助!最終成爲問題的是什麼? –

+0

@DrewTempleton,我已經更新了代碼,你能再次檢查嗎? –

相關問題