2013-03-21 41 views
0

我修改WordPress模板用以下结构主页上的两列:2列WordPress的留

enter image description here

但第4类别和最后4另一个

索引代码是:

http://pastebin.com/dMC0saBN

的页面是(列AR e,但他们所做的只是重复这个帖子。他们没有订购或过滤器)

crossfitlascondes.cl

+0

你可以分享的链接? – oscprofessionals 2013-03-22 06:17:24

+0

该页面的链接?... [http://crossfitlascondes.cl](http://crossfitlascondes.cl) – benitogonzalezh 2013-03-22 10:39:14

+0

只是为了确保...此图像是否显示您需要的内容? http://content.screencast.com/users/AnkurMantri/folders/Jing/media/e0b12327-a30f-4691-8575-864436bb0cc8/00000056.png – oscprofessionals 2013-03-22 12:36:22

回答

0

我发生的解决方案是在页面上创建两个循环,并通过分离,一个右列,一个用于左栏。所以我可以独立处理每个循环的代码而不会干扰其他列。

指数的代码是:

<?php get_header();?> 
<div id="contentslide"> 
    <?php 
     include(TEMPLATEPATH . '/slide.php'); 
     ?> 
</div> 
<?php 
    get_sidebar(); 
    ?> 
<div id="content"> 
    <div class="clear"> 
    </div> 
    <div id="contentleft"> 
    <div id="noticias">Noticias</div> 
    <?php if (is_home()) { query_posts($query_string . '&cat=-27'); } ?> 
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
     <div class="postleft" id="post-<?php 
      the_ID(); 
      ?>"> 
      <div class="title"> 
       <h2><a href="<?php 
        the_permalink(); 
        ?>" rel="bookmark" title="Permanent Link to <?php 
        the_title(); 
        ?>"><?php 
        the_title(); 
        ?></a></h2> 
      </div> 
      <div class="postmeta"> 
       <span class="author">Posted by <?php 
        the_author(); 
        ?> </span> <span class="clock"> <?php 
        the_time('M - j - Y'); 
        ?></span> <span class="comm"><?php 
        comments_popup_link('0 Comment', '1 Comment', '% Comments'); 
        ?></span> 
      </div> 
      <div class="entry"> 
       <?php 
        if (has_post_thumbnail()) { 
        ?> 
       <a href="<?php 
        the_permalink(); 
        ?>"><img class="postimgleft" src="<?php 
        bloginfo('stylesheet_directory'); 
        ?>/timthumb.php?src=<?php 
        get_image_url(); 
        ?>&amp;h=150&amp;w=200&amp;zc=1" alt=""/></a> 
       <?php 
        } else { 
        } 
        ?> 
       <?php 
        wpe_excerpt('wpe_excerptlength_index', ''); 
        ?> 
       <div class="clear"> 
       </div> 
      </div> 
     </div> 
    <?php 
     endwhile; 
    ?> 
    <?php 
     endif; 
    ?> 
    <?php 
     wp_reset_query(); 
     ?> 
    <div class="navigation"> 
     <div class="alignleft"><?php previous_posts_link('&laquo; Previous Entries') ?></div> 
     <div class="alignright"><?php next_posts_link('Next Entries &raquo;','') ?></div> 
    </div> 

    </div> 
    <div id="contentright"> 
    <div id="wod">WOD Diario</div> 
    <?php if (is_home()) { query_posts($query_string . '&cat=27&'); } ?> 
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
     <div class="postright" id="post-<?php 
      the_ID(); 
      ?>"> 
      <div class="title"> 
       <h2><a href="<?php 
        the_permalink(); 
        ?>" rel="bookmark" title="Permanent Link to <?php 
        the_title(); 
        ?>"><?php 
        the_title(); 
        ?></a></h2> 
      </div> 
      <div class="postmeta"> 
       <span class="author">Posted by <?php 
        the_author(); 
        ?> </span> <span class="clock"> <?php 
        the_time('M - j - Y'); 
        ?></span> <span class="comm"><?php 
        comments_popup_link('0 Comment', '1 Comment', '% Comments'); 
        ?></span> 
      </div> 
      <div class="entry"> 
       <?php 
        if (has_post_thumbnail()) { 
        ?> 
       <a href="<?php 
        the_permalink(); 
        ?>"><img class="postimgright" src="<?php 
        bloginfo('stylesheet_directory'); 
        ?>/timthumb.php?src=<?php 
        get_image_url(); 
        ?>&amp;h=150&amp;w=200&amp;zc=1" alt=""/></a> 
       <?php 
        } else { 
        } 
        ?> 
       <?php 
        wpe_excerpt('wpe_excerptlength_index', ''); 
        ?> 
       <div class="clear"> 
       </div> 
      </div> 
     </div> 

    <?php 
     endwhile; 
     ?> 
    <div class="clear"></div> 
    <?php 
     else: 
     ?> 
    <h1 class="title">Not Found</h1> 
    <p>Sorry, but you are looking for something that isn't here.</p> 
    <?php 
     endif; 
     ?> 
    <div class="navigation"> 
     <div class="alignleft"><?php previous_posts_link('&laquo; Previous Entries') ?></div> 
     <div class="alignright"><?php next_posts_link('Next Entries &raquo;','') ?></div> 
    </div> 
    <?php 
     wp_reset_query(); 
     ?> 
    </div> 
</div> 
<?php 
    get_footer(); 
    ?> 

和CSS代码(总结)是

#content { 
    float:left; 
    width: 665px; 
    height:100%; 
    padding:10px 0px 0px 0px; 
    margin:23px 0px 0px 15px; 
    display:inline; 
    overflow:hidden; 

    } 

#contentleft { 
    float:left; 
    width: 50%; 
    height:100%; 
    display:inline; 
    overflow:hidden; 

    } 

#contentright { 
    float:left; 
    width: 44%; 
    margin-left: 23px; 
    height:100%; 
    display:inline; 
    overflow:hidden; 

    } 

#contentslide { 
    float:left; 
    width: 665px; 
    height:100%; 
    padding:10px 0px 0px 0px; 
    margin:35px 0px 0px 15px; 
    display:inline; 
    overflow:hidden; 

    }