0
我已经开始啃我自己的wordpress模板,第一步我用HTML制作了草图。这是这样的。用于显示内容的PHP循环
我在想这件事,黑色矩形是“后的图像”,我想4一行。我应该用for循环来解决,while循环(我猜)。 在我看来,这应该是这样的(它的循环,从二11主题)
<?php
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php while (have_posts()) : the_post(); ?>
<?php for(i=0;i<8;i++)?>
{<?php get_template_part('content', 'page'); ?>}
<?php comments_template('', true); ?>
<?php endwhile; // end of the loop. ?>
</div>
</div>
<?php get_footer(); ?>
但我有问题,我应该如何与定位解决问题。我想这应该是一个职位的职位。下面我给你我的代码。请帮忙。
我的html代码:
<div class="postbar">
<div class="post1">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post2">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post3">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post4">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
</div>
<div class="postbar">
<div class="post1">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post2">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post3">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
<div class="post4">
<a href="index.html">
<div id="postOver"></div>
</a>
<div id="postText">text</div>
</div>
</div>
我的CSS代码:
div.postbar{
position:relative; left:255px;
height:222px;
}
div.post1 {
margin-top:17px;
position:relative;
margin-left:1%;
padding-left:3px;
padding-right:3px;
width:222px;
height:222px;
}
div.post2 {
position:absolute; top:-1px; left:260px;
margin-left:1%;
width:222px;
height:222px;
}
div.post3 {
position:relative; top:-222px; left:520px;
margin-left:1%;
padding-left:3px;
padding-right:3px;
width:222px;
height:222px;
}
div.post4 {
position:relative; top:-444px; left:780px;
margin-left:1%;
padding-left:3px;
padding-right:3px;
width:222px;
height:222px;
}
div.postNext {
position:absolute; left:250px; top:-1px;
margin-left:1%;
padding-left:3px;
padding-right:3px;
width:222px;
height:222px;
}
#postOver{
width:222px;
height:222px;
background-image:url(img/arch.jpg);
box-shadow:0px 0px 3px #000000;
-webkit-transition:width 1s;
}
*:hover > #postOver{
width: 0;
}
#postText{
position:relative; top:-222px;
font-size:12px;
width:222px;
height:222px;
box-shadow:0px 0px 3px #000000;
color:black;
text-align:center;
z-index:-1;
}
你会希望做一个自定义模板,并利用它来进行显示。 http://codex.wordpress.org/Pages#Examples_of_Pages_and_Templates – MetalFrog 2012-01-17 19:21:59
它看起来像你正在使用CMS ..没有看到建立内容的实际页面,它将很难调整它。你在使用joomla/Wordpress/etc吗?一些模块可能变得非常多毛。 – Silvertiger 2012-01-17 19:22:53
@Silvertiger我正在使用wordpress – 2012-01-17 19:24:05