Wordpress插件 - 我的插件在wordpress主页中有多少

时间:2011-07-15 09:36:32

标签: php wordpress-plugin wordpress-theming wordpress

我制作了简单的插件,我想在完整的帖子下面但不在主页上使用这个插件。插件只从我的数据库中读取图像并将图像放在帖子下面。

   function get_image_big() 

   {             
     echo file_get_contents('http://demotivators.us/widget/big_demotivators.php');        
   }

   add_action( 'loop_end', 'get_image_big');

如何在所有主题的wordpress主页中关闭此脚本? 为我的英语道歉。

2 个答案:

答案 0 :(得分:0)

您需要将代码添加到主题模板(每当您想要显示图像时)。 例如,如果要在单个帖子的末尾显示图像,则需要在此处添加函数调用。它看起来像这样:

if ( function_exists( 'get_image_big' ) ) { get_image_big(); }

答案 1 :(得分:0)

使用is_home()is_front_page()调用来检测主页是否显示。