Site icon Hip-Hop Website Design and Development

Get good title of class from slug (take away dashes of class)

I’ve a operate in a theme:

$class = isset($_GET['category']) ? wp_unslash($_GET['category']) : '';

The issue is that it outputs my classes like this:

"test-category"

I would like, nevertheless, to indicate: "Test Category", identical to it is saved within the backend, with out the dashes and the smaller letters.

Is there a approach I can do away with this slug and use the nicename as an alternative? I attempted quite a lot of issues (just like the get_term_by() operate), however nothing works for me. I suppose it is due to the truth that I’m utilizing the $class variable.

Can somebody assist me?