How to get jetengine term meta field value in php

How to get jetengine's term meta field value in php

Some of developers want to get term meta fields in php code and want to run query with it or create shortcode and get jetengine term meta field in it.

Very simple way to get term meta field created via Jetenigine Plugin.

Jetenigne term meta field value in php

Use it as simple term meta or term field.

Getting term field method “get_term_meta()“.

And “$cat->term_id” is id of term.

‘phone’ is meta key created via jetengine.

$phone = get_term_meta( $cat->term_id, 'phone', true );

This is full foreach loop that i use for categories

$id = 12, 30, 55;

$categories = get_categories(array(
	'include' => $id,
	));

<?php foreach($categories as $cat){
   $phone = get_term_meta( $cat->term_id, 'phone', true );
   $media = get_term_meta( $cat->term_id, 'image', true );
   $img_atts = wp_get_attachment_image_src($media, 'full');
?>
    <div class="col">
     <div class="img">
	<img src="<?php echo $img_atts[0];?>" alt="category image">   
    </div>
    <div class="content">
	<h3><?php echo $cat->name;?></h3>
	<div    class="button">
	 <a href="#" class="btn">
	   <img src="assets/images/Group 48.png" alt="">
	   <span><?php echo $phone;?></span>
	 </a>
       </div>
    </div>
 </div>
<?php } ?>

Hope this help you to create a better website and solve your problem 🙂

Get Jetengine’s post/page Meta Field In Php

GitHub Gist link

More Articles