我做了简单的插件,我想只在完整的帖子下工作,而不是在主页上。插件只从我的数据库中读取图像,并将图像放在帖子下面。
function get_image_big()
{
echo file_get_contents('http://demotivators.us/widget/big_demotivators.php');
}
add_action( 'loop_end', 'get_image_big');
如何关闭这个脚本在wordpress主页的所有主题?为我的英语道歉
使用is_home()
和is_front_page()
调用检测主页是否显示
您需要将代码添加到主题模板中(无论何时您想要显示图像)。例如,如果您想在单个帖子的末尾显示您的图像,则需要在那里添加函数调用。它看起来像这样:
if ( function_exists( 'get_image_big' ) ) { get_image_big(); }