• Resolved Iva

    (@supersonicsquirrel)


    Hello,

    I have been trying to figure out to display multiple custom fields with the same value and do not display them if there is no value entered. This is the piece of code I’m currently using and it outputs values when the person has not entered their instagram profile URL as well.

    So, basically, I’m looking for a way to show as many values as there are for as long as there are some or don’t show anything otherwise. And the values are always URLs in this case.

    Thank you!

    <span class='social-profile'>
    										<a href="<?php foreach($profileinstagram as $profileinstagram) {
    											echo ''.$profileinstagram.'';
    											}; ?>" target='blank'>
    											<img src='https://blogomanija.net/sajt/wp-content/themes/blogomanija/images/social/instagram-small.png' />
    										</a>
    									</span>
Viewing 1 replies (of 1 total)
  • Thread Starter Iva

    (@supersonicsquirrel)

    I apologise – this is the full piece of the code and it’s inside of the loop that is otherwise working fine.

    <?php
    									$profiletwitter = get_post_meta($post->ID, 'profiletwitter', true);
    									if ( ! empty( $profiletwitter ) ) {
    									?>
    									<span class='social-profile'>
    										<a>" target='blank'>
    											<img src='https://blogomanija.net/sajt/wp-content/themes/blogomanija/images/social/twitter-small.png' />
    										</a>
    									</span>
    									<?php } ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Displaying multiple URLs as custom field values’ is closed to new replies.