admin管理员组

文章数量:1389392

I have the CPT "proyectos" and the custom taxonomy "servicios"
I have navigation arrows inside the single CPT template to navigate between posts in the same category.
Some taxonomies have only one post so in this case I need to hide the navigation arrows.
I'm using Elementor so I can't edit the php template.
My idea was to generate a css rule to hide the navigation only if the above conditions are met.

I was trying something like this but obviously it didn`t work:

<?php $categories = get_the_terms( $post, 'servicios' );

if ( count($categories) == 1 ) { ?>
        <style>
  .navegacion-posts {
      display: none;
  }
</style>
<?php }

Can someone help me with this? Thanks!

本文标签: custom taxonomyHide post navigation if current post is in a category with only one post