如果将 PHP the_content放在 HTML 正文中的脚本之后,则执行不正确


php the_content executes incorrectly if placed after script in html body

我正在使用wordpress并使用以下方法将页面内容拖到html正文中。

<?php the_content(); ?>
当放置在脚本上方的任何位置

时,它可以正常工作,但是如果我将其放置在脚本之后页面上的任何位置,它会输出,就好像它是同一脚本的回显函数(我猜它是什么)。

谁能告诉我可能发生了什么,是否有办法阻止这种情况发生。我尝试将脚本放在单独的页面中并使用 include 函数将其拉入,但这也不起作用。

<?php
$pages = array(
    0 => 'longtailtext/intro1-1.php', 
    1 => 'longtailtext/intro1-2.php'
);
srand(floor(time()/60/60/1));
$key =rand(0,count($pages)-1);
include($pages[$key]) ;
?>

将内容标记放置在脚本之后的任何位置只会输出以下内容:"长尾文本/第1-1段.php"

感谢您在此:)上为我提供的任何帮助

可能是导致错误的流氓插件。试试这个:从这里 http://hungred.com/how-to/avoid-trouble-filter-thecontent-wordpress/。

也许你应该使用 http://codex.wordpress.org/Function_Reference/get_the_content