簡體   English   中英

在子主題中覆蓋父主題功能? 怎么樣?

[英]Override Parent Theme Function in Child Theme? How?

我想在此函數中更改輸出。

function ph_mailchimp($action){
    $msg = get_theme_mod('pic_mailchimp', 'text');
    $output = '
    <div class="newsletter-box well">
      <p>' . $msg  . '</p>
      <form accept-charset="UTF-8" action="'.$action.'" class="new_subscriber" data-remote="true" id="mc-embedded-subscribe-form" method="post">
        <div style="display:none">
          <input name="utf8" type="hidden" value="">
        </div>
        <input class="inputfield" id="mce-EMAIL" name="EMAIL" placeholder="Your email" type="email">
        <input name="subscribe" type="submit" value="Subscribe">
      </form>
    </div>';
    return $output;
}

基本上,我想在我的Child主題的functions.php文件中添加代碼,以覆蓋上述函數中的Output。

有人可以幫忙嗎? 謝謝。

如果設置正確,則可以。 從PECL安裝APD或從相同的Runkit安裝。 如果您有Runkit,這應該可以解決問題:

runkit_function_remove ( "ph_mailchimp" );

function ph_mailchimp() {
    echo "Foobar";//do stuff here
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM