gpt4 book ai didi

php - 主页 wordpress 中的 2 列

转载 作者:行者123 更新时间:2023-11-28 13:10:48 24 4
gpt4 key购买 nike

我修改了一个 wordpress 模板,在主页上留下两列,结构如下:

enter image description here

但前 4 个属于一个类别,后 4 个属于另一个类别

索引代码为:

http://pastebin.com/dMC0saBN

页面是(创建了专栏,但他们所做的只是重复发布。他们没有订购或过滤)

crossfitlascondes.cl

最佳答案

我想到的解决方案是在页面上创建两个循环并用 分隔,一个到右栏,一个到左栏。因此,我可以独立处理每个循环的代码,而不会干扰其他列。

索引的代码是:

    <?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;

}

关于php - 主页 wordpress 中的 2 列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15560116/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com