您可以使函数可过滤:
function brickAlign() {
$a = "true";
return apply_filters( \'brick_align\', $a );
}
然后,在子主题中添加过滤器回调:
function child_theme_filter_brick_align( $a ) {
return \'false\';
}
add_filter( \'brick_align\', \'child_theme_filter_brick_align\' );
或者,您可以向函数传递一个参数:
function brickAlign( $value = \'true\' ) {
// Note: you should add some error-checking here
$a = $value;
return $a;
}
然后,在子主题中,按如下方式调用函数:
<?php brickAlign( \'false\' ); ?>