Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Below is a functions.php code for wp_link_pages which allows pagination and previous/next links to be displayed. It also wraps each pagination link in a span class called "classlinks".

I need to change the default "Pages:" before the pagination while maintaining the rest of the code. My attempts removed the ability to show both next/previous links and pagination. Any help?

// WP_LINK_PAGES: Add prev and next links to a numbered link list
add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add');

    function wp_link_pages_args_prevnext_add($args)
{
    global $page, $numpages, $more, $pagenow;

    if($page-1) # there is a previous page
        $args['before'] .= ' '. _wp_link_page($page-1) 
            . $args['link_before'] . $args['previouspagelink']  . '</a>' . ' '
        ;

    if ($page<$numpages) # there is a next page
        $args['after'] = ' '. _wp_link_page($page+1)
           . $args['link_before'] . $args['nextpagelink']  . '</a>'
        ;

    $args['link_before'] = '<span class="classlinks">';
    $args['link_after'] = '</span>';

    return $args;
}
share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Add, right after the declaration of the global vars, e.g.: $args['before'] = '<p>Hello world: ';

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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