从另一个插件wordpress调用一个函数

时间:2013-11-23 13:42:13

标签: php wordpress wordpress-plugin

我遇到从另一个插件调用一个函数的问题,它似乎没有返回任何东西,这对其他插件工作

function caller_func()
{
if (!function_exists('form')) return;
return form($number = null);
}

function chrp1_get_popup(){

    $chrp1_popup = '<div id="fullscre"></div>';

    $chrp1__query= "post_type=popup-widget-details&showposts=1";

    query_posts($chrp1__query);

    if (have_posts())  : the_post();

    $chrp1_mykey_values = get_post_custom_values('code');

    $chrp1_descrip = get_the_content();

    $chrp1_popup .= '<span onclick="chrp1_showall();">'.$chrp1_descrip.'</span>';

    $chrp1_popup .= '<div id="newsox">';

    $chrp1_popup .= '<img src="'.chrp1_PATH.'image/cross.png" class="ccross" 
    onclick="chrp1_getrid();" width="23"/>';

    $getfunc = 'caller_func';
    $chrp1_popup .=  $getfunc();

    $chrp1_popup .= '</div>';



    endif; wp_reset_query();         

return $chrp1_popup;

}

此代码适用于我想要调用的其他插件,但下面没有这个可以帮助

function form($number = null) {
    if ($number == null)
        return $this->subscription_form();
    $options = get_option('newsletter_forms');

    $form = $options['form_' . $number];

    if (stripos($form, '<form') !== false) {
        $form = str_replace('{newsletter_url}', plugins_url('newsletter/do/subscribe.php'), $form);
    } else {
        $form = '<form method="post" action="' . plugins_url('newsletter/do/subscribe.php') . '" onsubmit="return newsletter_check(this)">' .
                $form . '</form>';
    }

    $form = $this->replace_lists($form);

    return $form;
}

当我检查源代码时,表单中没有任何内容已加载

0 个答案:

没有答案
相关问题