我想编辑我的导航模板。
我找到了一种方法,通过编辑wp-includes/link-template.php
替换此:
function _navigation_markup( $links, $class = \'posts-navigation\', $screen_reader_text = \'\' ) {
if ( empty( $screen_reader_text ) ) {
$screen_reader_text = __( \'Posts navigation\' );
}
$template = \'
<nav class="navigation %1$s" role="navigation">
<h2 class="screen-reader-text">%2$s</h2>
<div class="nav-links">%3$s</div>
</nav>\';
使用此选项:
function _navigation_markup( $links, $class = \'posts-navigation\', $screen_reader_text = \'\' ) {
if ( empty( $screen_reader_text ) ) {
$screen_reader_text = __( \'Posts navigation\' );
}
$template = \'
<footer>
<nav id="nav-below" class="navigation" role="navigation">%3$s</nav>
</footer>\';
它工作了,但我想编辑主题而不是Wordpress核心。
尝试编辑functions.php
使用此选项:
function custom_navigation_markup( $links, $class = \'posts-navigation\', $screen_reader_text = \'\' ) {
if ( empty( $screen_reader_text ) ) {
$screen_reader_text = __( \'Posts navigation\' );
}
$template = \'
<footer>
<nav id="nav-below" class="navigation" role="navigation">%3$s</nav>
</footer>\';
但它返回了500个错误。我做错了什么?
谢谢你的帮助。