我会将其包装在函数中(保存在functions.php
);
function wp_list_pages_with_hash( $hash, $args = \'\' )
{
$add_hash = create_function( \'$link\', \'return $link . "#\' . $hash . \'";\' );
add_filter( \'page_link\', $add_hash );
$result = wp_list_pages( $args );
remove_filter( \'page_link\', $add_hash );
return $result; // back compat in case \'echo\' was null
}
那就这样说吧!
<?php wp_list_pages_with_hash( \'target\', \'title_li=&depth=0\' ); ?>