Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter logan_x

    (@logan_x)

    Those are for pages.

    I tried to make the function code for posts, but it still doesn’t work.

    Here goes the code I made:

    $postlist = get_posts();
    $posts = array();
    foreach ($postlist as $post) {
    	$posts[] += $post->ID;
    }
    
    $current = array_search($post->ID, $posts);
    $prevID = $posts[$current-1];
    $nextID = $posts[$current+1];
    
    // Link for previous post
    if (!empty($prevID)) {
    	echo '<div><a href="'. get_permalink($prevID) .'?variable=true">Msg. Anterior</a></div>';
    }
    
    // Link for next post
    if (!empty($nextID)) {
    	echo '<div><a href="'. get_permalink($nextID) .'?variable=true">Pr&oacute;xima Msg.</a></div>';
    }

    Thread Starter logan_x

    (@logan_x)

    Anyone, please?

Viewing 2 replies - 1 through 2 (of 2 total)