我正在为子主题使用主题框架。它有许多钩子,但我特别关注 thematic_header() 。thematic_header() 钩子添加了以下操作(通过 add_action):
<?php
add_action('thematic_header', 'thematic_brandingopen', 1);
add_action('thematic_header', 'thematic_blogtitle', 3);
add_action('thematic_header', 'thematic_blogdescription', 5);
add_action('thematic_header', 'thematic_brandingclose', 7);
add_action('thematic_header', 'thematic_access', 9);
?>
动作的内容无关紧要。
我的问题是:我怎样才能改变所讨论的五项行动的优先级。例如,我希望thematic_access() 在thematic_brandingopen() 之前加载。我能够弄清楚的唯一方法是删除并重新添加操作,ala:
<?php
function remove_thematic_actions() {
remove_action('thematic_header', 'thematic_access');
add_action('thematic_header', 'thematic_access', 0); //puts it above thematic_brandingopen
}
add_action ('init', 'remove_thematic_actions');
这似乎是完成非常简单的事情的愚蠢方式。有没有办法访问和排序/重新排序在 WP 中存储操作的任何数据结构?