Get link picker custom field to show only if field exists

You’re testing if assigning a value to $mylink was successful in the if statement rather than testing if it’s empty. Try something like: <?php $article_link = get_field(‘article_link’); if( $article_link[‘url’] ): ?> <a href=”https://wordpress.stackexchange.com/questions/246505/<?php echo $article_link[“url’]; ?>”><?php echo $article_link[‘title’]; ?></a> <?php endif; ?> See Example 1 in the ACF docs.

How to echo the translated custom field?

can you do this: get_post_meta(get_the_ID(), ”, true); print_r($meta); or get_post_meta(get_the_ID(), ‘my_custom_field’); print_r($meta); the first will pull all custom post type on the current post, and the second restricts to the field. You should get an array and then you’ll know which item in your array is the field title you’re looking to pull. then you … Read more

Output Custom Field value to shortcode

Depending on the ngg_images shortcode, you maybe need to echo the do_shortcode function. You can try function lilap_gid($atts, $content = “”){ $gid = get_post_meta(get_the_ID(), ‘gallery_id’, TRUE); ob_start(); echo do_shortcode( ‘[ngg_images tag_ids=”‘. $gid .'”]’); $content = ob_get_clean(); return $content; } add_shortcode( ‘gallery_display’, ‘lilap_gid’ );

Importing URLs of Audio Enclosures

It’s hard to tell what you’re working with from the image, but I’ll assume newline breaks. <?php $string = “http://www.podcast.com/track.mp3 2207703 audio/mpeg”; echo “<pre>”; echo $string; // should show multiple rows To grab the first line, try preg_match: // now grab the first line if( preg_match (‘/^(.*)$/m’, $string, $matches) ){ echo $matches[0]; // first line … Read more

How to repeate custom field group with bulk image field

it need custom code to create repeatable fields but if you want ready-made solution than you may try this : https://github.com/WebDevStudios/CMB2 just include it in your theme/plugin and than check it’s example-functions.php file , it have example of repeatable fields 🙂 here is direct documentation link : http://cmb2.io/docs/field-types#-types-group it also support many other fields . … Read more