0

I would like to edit my navigation template.

I found a way to do this, by editing wp-includes/link-template.php

Replaced this :

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>';

With this :

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>';

It worked, but I would like to edit the theme rather than the Wordpress core.

Tryed to edit functions.php with this :

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>';

But it returned a 500 error. What am I doing wrong ?

Thanks for your help.

0

I found the solution.

I had to add this in functions.php :

add_filter('navigation_markup_template', 'my_navigation_template', 10, 2 );
function my_navigation_template( $template, $class ){

    return 
    '<footer>
        <nav id="nav-below" class="navigation" role="navigation">%3$s</nav>
    </footer>';
}

Source : http://wp-kama.ru/function/_navigation_markup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.