2016-05-12 70 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