PHP(Wordpress)相关文章的问题
我试图在single.php上的每一篇文章之后都展示一些真实的文章,但在以下方面遇到了一些问题: “分析错误:语法错误,中的文件意外结束。”。我肯定有错误,但我不知道如何解决它。 谁能帮我一下吗?先谢谢你PHP(Wordpress)相关文章的问题,php,wordpress,Php,Wordpress,我试图在single.php上的每一篇文章之后都展示一些真实的文章,但在以下方面遇到了一些问题: “分析错误:语法错误,中的文件意外结束。”。我肯定有错误,但我不知道如何解决它。 谁能帮我一下吗?先谢谢你 ... <?php $orig_post = $post; global $post; $categories = get_the_category($post->ID); if ($categories){ $category_id
...
<?php
$orig_post = $post;
global $post;
$categories = get_the_category($post->ID);
if ($categories){
$category_ids = array();
foreach ($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args = array(
'category__in' => $category_ids,
'post__not_in' => array(
$post->ID
) ,
'posts_per_page' => 3,
'caller_get_posts' => 1
);
$my_query = new wp_query($args);
if ($my_query->have_posts()){
echo '<h3 class="title_relatedcontent">Text:</h3><div id="related_posts"><ul>';
while ($my_query->have_posts()){
$my_query->the_post(); ?>
<li><div class="relatedthumb"><a href="<? the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a></div>
<div class="relatedcontent">
<h3><a href="<? the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
</div>
</li>
<?
}
}
echo '</ul></div>';
}
$post = $orig_post;
wp_reset_query();
// If comments are open or we have at least one comment, load up the comment template.
if (comments_open() || get_comments_number()):
comments_template();
endif;
endwhile; // End of the loop.
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar();
get_footer();
。。。
正如你在这篇文章中所看到的,stackoverflow的降价已经给了你一个关于发生了什么的线索。查看您的帖子的颜色编码。在列表html标记之后,您就缺少了一个php标记。您是否错过了在中编写php