• Resolved omniafausta

    (@omniafausta)


    Hai everyone,
    I hope you can help me. I have a problem with my categories.
    After some research I understand this:

    <?php the_category ( __( ', ', '' ) ) ?>

    should give me the categories the post is posted in, seperated by a comma. Most posts have only 1 category, but some have 2.
    What it does now (with the posts that have 2 categories) is show me the name of one category and then that name links to the other. So there must be something going horribly wrong.
    Any tips on what could be the problem??

    Here you can see an example:
    https://www.omniafausta.com/wordpress/dooreten/
    it shows the category ‘eigen projecten’ and if you click that, you go to ‘boeken’.
    I want it to show ‘categorie: boeken, eigen projecten’

    some extra info:
    I am making my own theme based on Tweaker3, with quite a bit of added stuff.

    Thanks for any help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter omniafausta

    (@omniafausta)

    update:
    <?php echo get_the_category_list(); ?> gives me both categories, but in an ul
    As soon as I add the seperator, it turns out as before (showing just the one category that links to the other)

    could it maybe be something in the functions of the theme I started with?

    Thread Starter omniafausta

    (@omniafausta)

    finally found the culprit! It was a plugin that made it happen.
    ‘Remove Title Attributes’
    When i deactivated it, the problem was gone.

    Thread Starter omniafausta

    (@omniafausta)

    and I found a function that does what i needed the plugin to do, without the trouble the plugin gave me!!

    function my_nav_notitle( $nav ){
      return $nav = preg_replace('/ title=\"(.*?)\"/', '', $nav );
    
    }
    add_filter( 'wp_nav_menu', 'my_nav_notitle' );
    add_filter( 'wp_page_menu', 'my_nav_notitle' );
    add_filter( 'wp_list_categories', 'my_nav_notitle' );
    add_filter( 'the_category', 'my_nav_notitle' );
    
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘having a weird problem with the_category’ is closed to new replies.