title: How to Print some WordPress Cateogries?
body: <p>I've the following code in attempt to print the second top category and the category of a search result:</p>
  
  <pre><code>$category = get_the_terms( $post_id , 'manualknowledgebasecat');
  $number =  $category[0] -&gt; term_id;
  echo get_category_parents( $numero, true, ' &amp;raquo; ' );
  </code></pre>
  
  <p>The previous code print the complete list of categories, but I only want it to print the second category and the current category. For example: If a search result has this categories: <code>Products &gt;&gt; NameOfTheProduct &gt;&gt; Manual &gt;&gt; Configurations</code>
  I just want to print the <code>NameOfTheProduct</code> and <code>Configurations</code>. How can I get to do that ?</p>
  
  <p>Thank you for you replies in advance.</p>
  
  <p>Best regards.</p>