Support

Account

Home Forums General Issues ACF and WPML on php code

Solved

ACF and WPML on php code

  • Hello,

    i have a website with three language (italian, english and spanish) and i use ACF for custom field. I have create all field in all language and i put this code on my single.php file:

    <div class="info">
              <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'indirizzo', true ) ) : ?>
    			<?php _e( 'Indirizzo: '); ?>
                </span>
                <?php the_field('indirizzo'); ?><?php endif; ?>
              </p>
              <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'address', true ) ) : ?>
    			<?php _e( 'Address: '); ?></span>
                <?php the_field('address'); ?><?php endif; ?>
              </p>
              <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'endereco', true ) ) : ?>
    			<?php _e( 'Endereco: '); ?>
                </span>
                <?php the_field('endereco'); ?><?php endif; ?>
              </p>
                 <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'telefono', true ) ) : ?>
    			<?php _e( 'Telefono: '); ?>
                </span>
                <?php the_field('telefono'); ?><?php endif; ?>
              </p>
                 <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'phone', true ) ) : ?>
    			<?php _e( 'Telephone: '); ?>
                </span>
                <?php the_field('phone'); ?><?php endif; ?>
              </p>
                 <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'telefone', true ) ) : ?>
    			<?php _e( 'Telefone: '); ?>
                </span>
                <?php the_field('telefone'); ?><?php endif; ?>
              </p>
                <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'email', true ) ) : ?>
    			<?php _e( 'Email: '); ?>
                </span> <a href="mailto:<?php the_field('email'); ?>">
                <?php the_field('email'); ?><?php endif; ?>
                </a></p>
              <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'sitoweb', true ) ) : ?>
    			<?php _e( 'Sito Web: '); ?>
                </span> <a href="http://<?php the_field('sitoweb'); ?>">
                <?php the_field('website'); ?>
                </a><?php endif; ?></p>
              <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'website', true ) ) : ?>
    			<?php _e( 'Website: '); ?>
                </span> <a href="http://<?php the_field('website'); ?>">
                <?php the_field('website'); ?>
                </a><?php endif; ?></p>
              <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'site', true ) ) : ?>
    			<?php _e( 'Site: '); ?>
                </span> <a href="http://<?php the_field('site'); ?>">
                <?php the_field('website'); ?>
                </a><?php endif; ?></p>
                <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'facebook', true ) ) : ?>
    			<?php _e( 'Facebook: '); ?>
                </span> <a href="<?php the_field('facebook'); ?>">
                <?php the_field('facebook'); ?>
                </a><?php endif; ?></p>
              <p><span class="list">
                <?php if ( get_post_meta( get_the_ID(), 'twitter', true ) ) : ?>
    			<?php _e( 'Twitter: ' ); ?></span>
                <a href="<?php the_field('twitter'); ?>"><?php the_field('twitter'); ?>
                </a><?php endif; ?></p>
            </div>

    But i have a problem. So if you look here roma4you.servizieweb.it i have a lot of space between the field. How can i correct?

    Thank’s

  • Hi @serviceweb

    I tried looking at your url, however, there is no reference of <span class="list"> in your code.

    Also, please describe the issue with more clarity.

  • Hello i solve my question with this code:

    <?php if ( get_post_meta( get_the_ID(), 'indirizzo', true ) ) : ?><p><span class="list">
    			     <?php _e( 'Indirizzo: '); ?>
                </span>
                <?php the_field('indirizzo'); ?> </p><?php endif; ?>
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘ACF and WPML on php code’ is closed to new replies.