回调
这是“Reactor”如何钩住回调
add_action( \'reactor_post_header\', \'reactor_do_standard_thumbnail\', 4 );
回溯(Backtrace)函数本身从链接的位置挂接
~/theme_root/library/inc/content/content-post.php
but 此文件由
class Reactor
. 此类/文件为
not 在主回调期间包括
hooked to after_setup_theme
in the functions.php
file on priority 10, 但在此之前,没有回调。然后它就被实例化了:
require locate_template(\'library/reactor.php\');
new Reactor();
当类被实例化并且
__construct()
或被调用,它钩住为默认thumb注册回调的回调
on priority 14 on the after_setup_theme
hook ... (仅供参考:采用lame PHP 4样式)。
add_action(\'after_setup_theme\', array( &$this, \'content\' ), 14);
那么
the content()
method 只包括另一个文件:
require_once locate_template(\'/library/inc/content/content-pages.php\');
以及
this file 是实际附加默认缩略图的缩略图
here.
add_action(\'reactor_post_header\', \'reactor_do_standard_thumbnail\', 4);
现在只需在中添加以下内容
your CHILD THEME functions.php
文件
/**
* Remove the original callback, add in a new one
*/
add_action( \'after_setup_theme\', \'wpse119843RemoveStandardThumbs\', 20 );
function wpse119843RemoveStandardThumbs()
{
// Removes it for posts AND pages. If you only want posts, use is_single()
if ( is_singular() )
remove_action( \'reactor_post_header\', \'reactor_do_standard_thumbnail\', 4 );
add_action( \'reactor_post_header\', \'wpse119843AddCustomThumbs\' );
}
/**
* The callback that formats the new output
*/
function wpse119843AddCustomThumbs()
{
$link_titles = reactor_option( \'frontpage_link_titles\', 0 );
if ( has_post_thumbnail() )
{
?>
// REFACTOR REACTOR
<?php
}
}
注意要保留更改,请使用
Child Theme. 当你仔细查看网站时
you\'ll see that there already exists one.