我无法“看到”的价值$originalArticle
在里面echo \'/\'.$originalArticle.\'== &\'.$sameArticle;
: 我以前尝试过“global”,但它不起作用。。。例如,输出为:
/===&;48
有什么帮助吗?
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php $originalArticle = the_ID(); //this works ?>
<h2 class="entry-title">…</h2>
<div class="entry-utility">…</div><!-- .entry-utility -->
<?php
$cats = get_the_category();
$cat_obj = array_shift($cats);
$cat_id = (int) $cat_obj->cat_ID;
$second_query = new WP_Query( \'cat=\'.$cat_id.\'&posts_per_page=2\' );
while ( $second_query->have_posts() ) : $second_query->the_post();
$sameArticle = get_the_ID();
/* HERE */ echo \'/\'.$originalArticle.\'== &\'.$sameArticle; //output : /== &48
if ( $originalArticle == $sameArticle )
{
} else {
//...
谢谢你的帮助