[Plugin: Simple Fields] Custom fields with a single post query
-
Am having trouble pulling in custom fields meta with a custom single post query
Am using this to display a tooltip over a portfolio item with the portfolio items related testimonial within the tool tip.
<?php if($portfolio_testimonial_id) { ?> <div class="tooltip"> <?php $post_id = $portfolio_testimonial_id; $queried_post = get_post($post_id); ?> <h3> <?php echo $queried_post->post_title; ?> </h3> <p><?php echo $queried_post->post_content; ?> </p> <?php $testimonial_author = simple_fields_get_post_value(get_the_id(), array(5, 1), true); ?> <?php $testimonial_company = simple_fields_get_post_value(get_the_id(), array(5, 2), true); ?> <?php $testimonial_url = simple_fields_get_post_value(get_the_id(), array(5, 3), true); ?> <p class="testimonial_meta"><?php echo $testimonial_author; ?></p> <p class="testimonial_meta"><?php echo $testimonial_company; ?></p> <a href="https://<?php echo $testimonial_url; ?>"><?php echo $testimonial_url; ?></a> </div> <?php } ?>
I know the code I have is not the correct code to do this but I can’t find or discover the right code to use. I can’t use a standard or custom loop as nested loops start to get really messy and waste a lot of time ??
Any suggestions?
Thanks
- The topic ‘[Plugin: Simple Fields] Custom fields with a single post query’ is closed to new replies.