Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #821516

    Hi,
    I have a custom post type and custom taxonomy set up.
    I wish to add the name of the relevant custom taxonomy as an H1 heading on its archive page.
    I added archive.php to my child theme and inserted the following line:
    <h1 class="custom-cat-title">You are now in <?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?> category.</h1>
    This works fine for normal post category archive pages but does not work with my custom taxonomies (I guess that get_the_category is only for categories which custom taxonomies are not).
    Could you please provide me a snippet that will achieve this? I havbe been trying using get_the_terms without much luck.
    Many Thanks, M

    #821759

    Hey M1000000,

    Here are some threads to consider:
    https://wordpress.stackexchange.com/questions/136762/show-all-terms-of-a-custom-taxonomy
    https://stackoverflow.com/questions/38032911/wordpress-get-custom-taxonomy-from-a-custom-post-type

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #821768

    Hi Victoria,
    Thanks, but way beyond my php ability :(
    No simple option I can just paste into archive.php as above?
    M

    #822011

    Hi M,

    You might want to hire a freelancer to do it for you, if this seems like too much for you, as these kind of customizations are out of the scope of our support.

    If you need further assistance please let us know.
    Best regards,
    Victoria

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.