Support » Theme: Hueman » Title for custom taxonomy archives

  • Resolved manasek

    (@manasek)


    Could someone poit me where I can modify a theme code in order to properly show a title for custom taxonomy archives? I suggest to add the custom taxonomy support in a future update.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    The function for showing category title and archive title is in init-front.php
    https://themes.trac.wordpress.org/browser/hueman/3.2.10/functions/init-front.php#L273

    It’s a pluggable function, which means you can write your own function hu_get_term_page_title() in your child theme style.css

    Thank you

    Hi,

    thank you for your advice. I have modified a/m function and put it into my child theme functions.php:

    /****************************** Override Theme Term Page Title text and icon ******************************/
    /*  Term Page title
    /* @todo => generalize to all taxinomies, including custom ones
    /* ------------------------------------ */
    if ( ! function_exists( 'hu_get_term_page_title' ) ) {
      function hu_get_term_page_title() {
        if ( is_category() ) {
          $title = sprintf('<i class="fa fa-folder-open"></i>%1$s <span>%2$s </span>',
              __('Category:','hueman'),
              single_cat_title('', false)
          );
        }
        else if ( is_tag() ) {
          $title = sprintf('<i class="fa fa-map"></i>%1$s <span>%2$s </span>',
              __('Oblast:','hueman'),
              single_tag_title('', false)
          );
        }
        if ( is_tax() ) {
          $title = sprintf('<i class="fa fa-map-marker"></i>%1$s <span>%2$s </span>',
              __('Místo:','hueman'),
              single_term_title('', false)
          );
        }
        return $title;
      }
    }
    

    But I have no succcess, you can see it here: http://telezjetele.cz/misto/smrcina/

    Both is_tax() and single_term_title() seem to work – the same code at the same page works as you can see in the sidebar on the top (“Místo: Smrčina”). I put this code into PHP enabled text widget:

        if ( is_tax() ) {
          $title = sprintf('<i class="fa fa-map-marker"></i>%1$s <span>%2$s </span>',
              __('Místo:','hueman'),
              single_term_title('', false)
          );
        echo $title
        }
    

    What am I doing wrong? I am not a professional PHP coder…

    • This reply was modified 3 years, 11 months ago by manasek.

    Hi,

    Your function is correct.
    I forgot to mention that you will also need to override this template in your child theme.
    https://themes.trac.wordpress.org/browser/hueman/3.2.10/parts/page-title.php

    Problem is at line 21
    https://themes.trac.wordpress.org/browser/hueman/3.2.10/parts/page-title.php#L21
    You need to add is_tax() to allow function hu_get_term_page_title to work.

    Thank you

    Fantastic, it works, thank you. Please, could a theme author consider adding custom taxonomy support in a future update?

    Thank you

    You are welcome. Thank you.

    @manasek, could you post your new code please?
    I have a similar problem and I think I could try to solve it modifying your code.
    Thanks!

    My problem: https://wordpress.org/support/topic/wrong-title-in-taxonomies-archives/#post-9004040

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Title for custom taxonomy archives’ is closed to new replies.