Help needed with category and title in header

enter image description here

First i am abit in wordpress , but anyway i am trying to show the page category and page title in my header.php .
Like this below

But here is the thing , what I like to know is there away to iether remove the category if the category is empty!, and the remove the category and title on the homepage .

Here is the code what I use at this moment thanks

<div class="sub-navbar">
<ul class="sub-text">
    <li class="breadcrumb-item"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"> Homepagina</a></li>
    <li class="breadcrumb-item"><?php the_category( 'get_category_link' ); ?></li>
    <li class="breadcrumb-item last-sub-text"><?php the_title(''); ?></li>
</ul> 

Read more here:: Help needed with category and title in header

Leave a Reply

Your email address will not be published. Required fields are marked *