title: Get WordPress Current Category ID and Top Level Parent Category ID on all category and post templates
body: <p>Say you have WordPress site with for example with the following structure:</p>
  
  <pre><code>Dog (Top Level Category)
  -Boxer (Sub Level Category)
  --Brindle (Third Level Category)
  --Reverse Brindle (Third Level Category)
  -Golden Retriever (Sub Level Category)
  -Labrador (Sub Level Category)
  
  Cat (Top Level Category)
  -Siamese (Sub Level Category)
  --Siamese Black (Third Level Category)
  --Siamese White (Third Level Category)
  -Bengal (Sub Level Category)
  -Ragdoll (Sub Level Category)
  </code></pre>
  
  <p>Attempting to develop a function to add to all the page templates such as category.php, single.php, etc, so that the side menu will show the full category hierarchy based on your location. Such as if you are viewing Dog category, or boxer, or brindle it would show the same full Dog menu like above with each linked to their respective categories and the one you are on would have an active class.</p>
  
  <p>Also at the top of the page to output Top Level Category and the category you are on. Such as if on Reverse Brindle would say, "Dog > Reverse Brindle" or if on Dog would just say, "Dog" or if on Boxer would say "Dog > Boxer. </p>
  
  <p>Have it sort of working but with a lot of redundant code and on same pages not working as expected. </p>