我的网站正在为同一篇文章显示两个不同的ID(如果是print\\r)。如果我问:
<?php echo $post->ID;?>
在单曲中。php它给了我一个数字。如果我在侧边栏中做同样的事情,它会给我一个完全不同的结果。
这就是我在单曲上打印的内容。php
stdClass Object ( [ID] => 59 [post_author] => 1 [post_date] => 2012-01-01 20:29:18
[post_date_gmt] => 2012-01-01 20:29:18 [post_content] => È universalmente
riconosciuto (...) [post_title] => fdsfdsfs [show_in_menu] => 1 [link_link] => 1
[no_follow_link] => 0 [alt_link_text] => [custom_link_class] => [redirect_url] =>
[target_blank] => 0 [alt_title_attribute] => [post_excerpt] => [post_status] => publish
[comment_status] => closed [ping_status] => closed [post_password] =>
[post_name] => fdsfdsfs [to_ping] => [pinged] => [post_modified] => 2012-01-07 19:53:44
[post_modified_gmt] => 2012-01-07 19:53:44 [post_content_filtered] =>
[post_parent] => 0 [guid] => http://www.museidibra.it/prova/?p=59 [menu_order] => 0
[post_type] => post [post_mime_type] => [comment_count] => 0
[ancestors] => Array ( ) [filter] => raw )
这是我从侧边栏中得到的:
stdClass Object ( [ID] => 93 [post_author] => 1 [post_date] => 2012-01-02 08:39:29
[post_date_gmt] => 2012-01-02 08:39:29 [post_content] => prova 3 (...)
[post_title] => prova 3 [show_in_menu] => 1 [link_link] => 1 [no_follow_link] => 0
[alt_link_text] => [custom_link_class] => [redirect_url] => [target_blank] => 0
[alt_title_attribute] => [post_excerpt] => [post_status] => publish
[comment_status] => closed [ping_status] => closed [post_password] =>
[post_name] => prova-3 [to_ping] => [pinged] => [post_modified] => 2012-01-07 13:06:15
[post_modified_gmt] => 2012-01-07 13:06:15 [post_content_filtered] =>
[post_parent] => 0 [guid] => http://www.museidibra.it/prova/?p=93 [menu_order] => 0
[post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw )
基本上是两个不同的职位。
注意:这件事只发生在我标记的帖子中。如果我没有标记帖子,那么生成的ID将是相同的。
Here, 你可以在我的网站上找到一个例子,print\\r为同一篇文章显示了两个不同的ID。
救命啊,这东西把我吓坏了。
谢谢
最合适的回答,由SO网友:helgatheviking 整理而成
你是否有一个查询将那些相关的帖子放在最下面?4个方块?
看起来您需要一个wp\\u reset\\u query(),因为最后一个方块的标题是“prova 3”,这是您在侧栏中显示对象数据的帖子。