No output from wp_link_pages()

wp_link_pages() in content-single.php does not working (giving any output). I created and tested on new installation WP3.6+roots6.4 (on Ubuntu and Win7). Create two categories and some posts in both. Nothing else, everything is default, except premalinks (and language). This function on single post does not produce one charcter. Anybody have any thoughts.
For solution I used twentythirteen_post_nav() function and adapted to work with roots. Dont know what ‘Pages:’, ‘roots’ are doing there (I think nothing) but does not have time to experiment. Function displays post titles insted of Prev and Next, and I added true (third parameter in prev/next_post_link()) for steping in same category (but it does not work always).

if ( ! function_exists( 'sgcustom_post_nav' ) ) :
function sgcustom_post_nav() {
	global $post;

	// Don't print empty markup if there's nowhere to navigate.
	$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
	$next     = get_adjacent_post( false, '', false );

	if ( ! $next && ! $previous )
	<nav class="post-nav">
		<ul class="pager">
			<li class="next"><?php next_post_link( '%link', _x( '%title <span class="meta-nav">&rarr;</span>', 'Pages:', 'roots' ), true ); ?></li>
			<li class="previous"><?php previous_post_link( '%link', _x( '<span class="meta-nav">&larr;</span> %title', 'Pages:', 'roots' ), true ); ?></li>

I realy don’t know why my source look like that, I mean blue and white?

I fixed your code highlighting. For future reference, you can add your code between a block like this:


Thaks @swalkinshaw.

I tested original (no languages version) of WP3.6+roots6.4 and wp_links_pages does not work here too. I think that this is error because wp_links_pages first test $multipage global and works if is not false. In our case (for single-posts) this global is always false (both categories and archives). Am I right. If yes I propose change in spartan way (no functions). Insted of call to wp_links_pages this code:

<nav class="post-nav">
  <ul class="pager">
    <li class="previous"><?php previous_post_link( '%link', '&larr; %title' ); ?></li>
    <li class="next"><?php next_post_link( '%link', '%title &rarr;' ); ?></li>

If @ben check this and I am right I will fork-poll-change-push-pullrequest it (if I got Git right).


Two completely different things are being done. The function wp_link_pages will navigate between the different pages of one multiple-paged post, whereas previous_post_link and next_post_link will navigate back and forth between multiple posts.

You will definitely need the wp_link_pages function and markup, but linking to posts within posts should be optional.

Thanks @Foxaii for clearing it up to me. I suspected that I get something wrong but multi-paged post did not cross my mind. Only I not so shur that I definitely need them.