- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何将 wordpress 帖子对齐到这样的不规则结构中:
帖子 1 |帖子 2 |后 3
第 4 行 |帖子 5 |帖子 6 |后 7
帖子 8 |发布 9 |发布 10
第 11 行 |后 12 | 13 号后 |后 14
帖子显示为列表。我需要一些逻辑来将帖子对齐到不规则结构中。
<?php get_header(); ?>
<!-- Getting posts -->
<div class="kategorie-vypis">
<div class="container">
<h1 class="stredny-nadpis">Kategorie</h1>
<ul>
<?php foreach((get_the_category()) as $category) { ?>
<h3><?php echo $category->category_description . ' '; ?></h3>
<?php $catVal = $category->cat_ID; }
$IDOutsideLoop = $post->ID;
global $post;
$myposts = get_posts('category=1&showposts=999'.$catVal);
foreach ($myposts as $post) { ?>
<li<?php if($IDOutsideLoop == $post->ID) { echo " class=\"current-post jeden-vypis\""; } ?>>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('small-thumbnail', array('class' => 'img-responsive logo-mini')); ?><span class="jeden-vypis-link"><?php the_title(); ?></span></a></li>
<?php }; ?>
</ul>
</div>
</div>
<?php get_footer(); ?>
最佳答案
只需使用几个变量:
<?php
$control = 3;
$current = 0;
foreach((get_the_category()) as $category) {
if ($current == 0)
echo "<div>";
?>
/***************************************/
<?php
$current++;
if ($current >= $control){
echo "</div>";
$current == 0;
if($control == 3)
$control = 4;
else
$control == 3;
}
}; ?>
关于php - (Wordpress) 不规则的 3-4-3-4 帖子结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38655274/
negExpression : (NOT^)* primitiveElement ; 是我的规矩。我现在有这个代码: !!(1==1) 我希望我最终会得到这棵树: NOT | NOT
我遇到以下问题,我正在创建一个作为预算副本的表单,但这种类型的预算不包含增值税%,并且商品不会通过会计。 问题如下我创建了一个名为budget.table的模型如下: class TableEleme
我对 Java 相当陌生,但对一般编程不太熟悉。我在 Windows Vista 上使用 Java 1.7.0_07。我正在尝试弄清楚如何使 Swing Timer 定期计时。 我注意到,即使我设置了
我有一个静态站点,它突然显示不规则的标题。这是一个包含大量 JavaScript 的单一页面,包括页面顶部的表格选择。该网站六个月前运行良好。现在,我在 12 个不同的导航选项卡中的一半上看到无法解释
在我参加的 CS 类(class)中,有一个不规则语言的例子: {a^nb^n | n >= 0} 我可以理解它是不规则的,因为没有有限状态自动机/机器可以编写来验证和接受此输入,因为它缺少内存组件。
给定以下高频但稀疏的时间序列: #Sparse Timeseries dti1 = pd.date_range(start=datetime(2015,8,1,9,0,0),periods=10,fr
我有 X、Y、Z 格式的数据,其中所有数据都是一维数组,Z 是坐标 (X,Y) 处的测量幅度。我想将此数据显示为等高线或“imshow”图,其中等高线/颜色代表 Z 值(幅度)。 用于测量和 X 和
这是 Stackoverflow 上的一个递归问题,但给出的解决方案 here仍然不完美。对我来说,屈服仍然是 python 中最复杂的东西之一,所以我不知道如何自己修复它。 当给定函数的任何列表中的
我使用 PHP 5.3.3 在 RHEL 6 服务器上部署了一个 symfony 1.4 项目。我不定期地在 php 错误日志中收到条目,提示找不到 sfProjectConfiguration 并且
我是一名优秀的程序员,十分优秀!