在我的WP插件中,我需要在不同的文件中调用它的一些功能,
我需要在/wp-content/plugins/wolf-jplayer/includes/jplayer-show.php
中调用public function head_script( $id, $playlist_id, $songs, $in_popup, $autoplay = false ) {
/wp-content/themes/twentlytwelve/index.php
,然后将该函数从其原始位置删除,因为它将会在Index.php中。那可能吗?我尝试了一切,没有任何效果。
@Niels我的用法:用于wp-content / themes / twentytwelve / header.php
<?php
$Wolf_Jplayer_Show = new Wolf_Jplayer_Shows;
$Wolf_Jplayer_Show->head_script( $id, $playlist_id, $songs, $in_popup, $autoplay = false );
?>
该功能位于wp-content / plugins / wolf-jplayer / includes / jplayer-show.php
答案 0 :(得分:1)
该函数可能是类的一部分。如果您保持激活插件,则可以通过;
创建类的实例<?php
$the_class = new Classname;
$the_class->function_name();
?>