我试图每三篇文章向我的博客订阅源添加一张图片。我正在使用Fishpig为Magento提供的wordpress集成扩展。
这是我必须使用的代码:
<?php $posts = $this->getPosts() ?>
<?php if (count($posts) > 0): ?>
<div class="post-list">
<ul id="post-list">
<?php foreach($posts as $post): ?>
<li class="item<?php if ($post->isSticky()): ?> featured is-sticky<?php endif; ?> <?php echo $post->getPostFormat() ?>">
<?php echo $this->getPostRenderer($post)->toHtml() ?>
</li>
<?php endforeach; ?>
</ul>
<script type="text/javascript">decorateList($('post-list'));</script>
<?php echo $this->getPagerHtml() ?>
</div>
<?php endif; ?>
任何帮助都将不胜感激。感谢
它很简单。
只需使用以下代码:
<?php $posts = $this->getPosts() ?>
<?php if (count($posts) > 0): ?>
<div class="post-list">
<ul id="post-list">
<?php $count=0; foreach($posts as $post): ?>
<li class="item<?php if ($post->isSticky()): ?> featured is-sticky<?php endif; ?> <?php echo $post->getPostFormat() ?>">
<?php $count++;if($count%3==0){?>
<img src="<?php echo {you image url}?>" />
<?php }?>
<?php echo $this->getPostRenderer($post)->toHtml() ?>
</li>
<?php endforeach; ?>
</ul>
<script type="text/javascript">decorateList($('post-list'));</script>
<?php echo $this->getPagerHtml() ?>
</div>
<?php endif; ?>