У моего сайта Wordpress есть проблема: В моем блочном цикле только первое сообщение содержит контент; для остальных the_content();
никогда не назывался (проверяется с помощью элемента «проверка»). Любые проблемы в моем коде?Только первый пост имеет контент в цикле
PHP/HTML:
<section id="blogPosts" class="clearfix">
<?php $myposts = get_posts('');
foreach($myposts as $post) :
setup_postdata($post);
?>
<div id="post-<?php the_ID(); ?>" class="post clearfix">
<div class="postHeader clearfix">
<a href="<?php the_permalink();?>">
<h2><?php the_title(); ?></h2>
</a>
<h4><?php the_date(); ?></h4>
</div>
<div class="postTags clearfix">
<ul class="tagContainer clearfix">
<?php the_tags('<li><div class="tagInline">',
'</div></li><li><div class="tagInline">',
'</div></li>'); ?>
</ul>
</div>
<div class="blogContent">
<?php the_content();?>
</div>
<div class="editPost">
<?php edit_post_link('<h4>Redigera detta inlägg', '', '</h4>'); ?>
</div>
<?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
<?php //comments_template(); ?>
</div>
<?php endforeach; wp_reset_postdata(); ?>
</section>
'get_posts ('')' выглядит подозрительно. Разве это не массив аргументов? – wavemode
Любая идея о том, какой должен быть массив? –