Support

Account

Home Forums General Issues Portfolio Taxonomy: Names of Selcted Categories Under Custom Field Reply To: Portfolio Taxonomy: Names of Selcted Categories Under Custom Field

  • I finally had to give up and use the Toolset Types plugin, which has some of the ACF function and inserts some of the custom field code into the wordpress itself. I can see two problems with this:

    1. It’s doing the dirty work for me. I still don’t know where it is putting the code or how it works.

    2. If I make a mistake or change my name about which field name to use, it could leave a trail of unused fields and code. I don’t know if that’s what it does, but I have no way of verifying either because I don’t know where it is inserting code into the theme.

    But after using it, I could use this snippit

     <?php if (get_the_term_list($post->ID, 'media-type', '', '<br />', '')): ?>
      <div>
      <h4><?php esc_html_e('Media:'); ?></h4>
      <div>
      <?php
      echo get_the_term_list($post->ID, 'media-type', '', ',&nbsp;', '');
    ?>
                                   </div>
                                </div>
    <?php endif; ?> 

    because now I have another custom category type built into my wordpress (right along side the existing “category” and “tag” options in wordpress).

    I also found out that the spaces (”) in places like this
    echo get_the_term_list($post->ID, 'media-type', '', ',&nbsp;', '');

    actually serve as a substitute for the

    if( count($values)){
        foreach($values as $k=>$value){
            if($k) echo ',  ';
           echo $value;
        }
    }

    part of the code and that it isn’t a good idea to use “if (count($values))” if the value is ever empty, but some of the problems associated with using anything with “empty()” was way over my head. Maybe someone can come along later and explain how someone could have an archive link (that part was solved by john) associated with the category name in a theme’s custom portfolio taxonomy.