Display Custom Field for Product Categories


/ Published in: PHP
Save to your folder(s)

This example for meta tags


Copy this code and paste it in your HTML
  1. <?php $taxonomyID = get_queried_object()->term_id;
  2.  
  3. //$metaname=get_field('meta_name', 'product_cat_' . $taxonomyID);
  4. $metacontent=get_field('meta_content', 'product_cat_' . $taxonomyID);?>
  5. <?php if ($metacontent) { ?>
  6. <meta name="description" content="<?php echo $metacontent; ?>"/>
  7. <?php } else { ?>
  8. <?php woo_meta(); ?>
  9. <?php } ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.