Returning only listing-category name in custom header

Hello. Happy New Year all.

I’m returning the category name in a custom header depending on what listing category is being viewed. However, my way of rendering it renders alot of html containers with classes, and also the listing-count and listing description.

Is there any way to dig further into this and just return the string of text of the category name? If not, is it possible to just get the category name with the html containers, without the listing counter and description?

I’d prefer just a string with the category name, so I’d be able to customize it easier.

<?php
            echo hivetheme()->template->render_part(
                'hivepress/listing-category/view/page/listing-category-header',
                [
                    'listing_category' => \HivePress\Models\Listing_Category::query()->get_by_id(get_queried_object()),
                ]
            );
            ?>

Thank you

Thanks, happy holidays!

You can try creating a variable first and then using its properties:

$category = \HivePress\Models\Listing_Category::query()->get_by_id(get_queried_object());

echo $category->get_name();
1 Like

Thank you. Worked <3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.