To understand why get_the_category();
didn’t work we have to take a closer look at the Codex page for that function. More specifically, what that function returns.
(array) Array of WP_Term objects, one for each category assigned to the post.
You tried to print an Array to HTML, which is why it didn’t work.
Instead, take a look at the get_the_category_list()
function as seen on the Codex, which says:
Retrieve category list in either HTML list or custom format.
You also forgot to end your php snippet with a ?>
. So to wrap it all up…
<div class="post-meta-categories"><i class="fa fa-tags"></i> <?php echo get_the_category_list(','); ?></div>
Which returns a list of comma separated post categories with clickable links.