Site logo

Archived topic

Show category over post-title

6 replies · Started by Jens on December 9, 2020

Viewing posts 1–7 of 7

Hello,

I want to move the category over the heading (generate_before_entry_title). The tags should remain below the post. How can this be achieved?

I am using a child theme.
Can this be done via a filter in the funktions.php, with hooks or do I need a new template?

Thank you for your response.

Hi there,

can you share a link to your site so i can see the current layout?
And do you want to move this on Acrhives or single posts or both.

Hello David,

I was able to solve part of the problem. The category is displayed correctly. But it is not a link, just text.
I used this filter in functions.php:

add_filter( 'generate_hooks_execute_php', '__return_true' );

and this hook:

<div class="navigation-title-container">
    <div class="navigation-category">
        <?php
        $category = get_the_category(); 
        echo $category[0]->cat_name;
        ?>
    </div>
</div>

I need an idea for the category link

Many thanks

OK so instead of:

<?php
$category = get_the_category(); 
echo $category[0]->cat_name;
?>

Try:

<?php echo generate_do_post_meta_item( 'categories' ); ?>

I am happy. Thank you very much.

Glad to hear that!

This archived topic is closed to new replies.