2016-05-12 44 views
4

在Wordpress上開發新主題時,我只注意到add_theme_support不適合我。在頭部結束之前我稱<?php wp_head();?>,在身體結束之前叫<?php wp_footer();?>。我正在使用Wordpress版本4.1.1。任何人都可以幫我整理一下嗎?我累了想了這麼多次,但沒有運氣:(add_theme_support無法在functions.php上工作

回答

3

在其掛鉤並添加add_theme_support後 請嘗試after_setup_theme鉤狀下面的例子:?

add_action('after_setup_theme', 'my_function_after_setup_theme'); 
function my_function_after_setup_theme() { 
    add_theme_support('automatic-feed-links'); 
} 
+0

我沒有使用任何鉤我只需簡單地在functions.php文件中使用這些代碼: - add_theme_support('title-tag'); add_theme_support('custom-header',array('default-image'=>'images/header.png') ); add_theme_support('custom-background'); 這些都不起作用 – Gamer

+3

我明白了。它應該在functions.php中調用,或者應該掛在after_setup_theme上。 (請查看代碼https://codex.wordpress.org/Function_Reference/add_theme_support) 您可以將您的呼叫添加到上面的功能嗎? –

+0

謝謝。我的問題已解決。你們是非常有幫助的。當我發佈任何東西在stackoverflow = D – Gamer