title: Wordpress get the previous/next buttons to work using category inside article
body: <p>So I modified the single-news.php file in order to get a previous/next button to navigate the news but that code uses the post id and for example im at post1 which belongs to category1, what I press "next" it doesnt go the next post in the same category necessarily.</p>
  
  <pre><code>    &lt;?php
  if ( is_single() ):
      $prev = get_previous_post_link();
      $prev = str_replace( '&amp;laquo;', '&lt;div class="wrapper"&gt;&lt;span class="fa fa-angle-left"&gt;&lt;/span&gt;', $prev );
      $prev = str_replace( '&lt;/a&gt;', '&lt;/a&gt;&lt;/div&gt;', $prev );
      $next = get_next_post_link();
      $next = str_replace( '&amp;raquo;', '&lt;span class="fa fa-angle-right"&gt;&lt;/span&gt;&lt;/div&gt;', $next );
      $next = str_replace( '&lt;a', '&lt;div class="wrapper"&gt;&lt;a', $next );
      ?&gt;
      &lt;div class="shapely-next-prev row"&gt;
          &lt;div class="col-xs-6 text-left" &gt;
              &lt;?php echo wp_kses_post( $prev ) ?&gt;
          &lt;/div&gt;
          &lt;div class="col-xs-6 text-right"&gt;
              &lt;?php echo wp_kses_post( $next ) ?&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Any idea on how I should modify this code? I've seen that this has been asked many times but I couldnt implement the ideas from these posts.</p>
  
  <p>I have tried that but it doenst show anything:</p>
  
  <pre><code>$next = next_post_link( $format, $link, $in_same_term = true, $excluded_terms = '', $taxonomy = 'category' );
  </code></pre>
  
  <p>Also for the news I use the Wp news and Scrolling widgets</p>
  
  <p>Edit:
  when I use this I have the same result as now</p>
  
  <pre><code>    $next = get_next_post_link('&amp;laquo; %link', '%title', FALSE);
  </code></pre>
  
  <p>but when I use it like this is doesn't show anything:</p>
  
  <pre><code>    $next = get_next_post_link('&amp;laquo; %link', '%title', TRUE);
  </code></pre>