pobranie pola custom fields
<?php the_field(’name’); ?>
<?php echo get_field(’name’);?>
<?php echo get_field(’name’, ID);?>
<?php if(get_field(’name’)): ?><h2><?php the_field(’name’); ?></h2><?php endif; ?>
pobranie ze sprawdzeniem czy pole ma wartość:
<?php if(get_field('copyright')): ?>
<?php the_field('copyright');?>
<?php endif; ?>
–
Pobranie wartości ACF Radio:
<?php if( in_array( 'code', get_field('technology') ) ){ ?> <img src="images/icon-code.png" alt="code"/><?php } ?>
<?php if( in_array( 'html5', get_field('technology') ) ){ ?> <img src="images/icon-html.png" alt="html5"/><?php } ?>
<?php if( in_array( 'css3', get_field('technology') ) ){ ?> <img src="images/icon-css.png" alt="css3"/><?php } ?>
<?php if (get_field('style') == 'full') { ?>
<div id="full"><?php the_field('box_text'); ?></div>
<?php } else if (get_field('style') == 'half') { ?>
<div id="half"><?php the_field('box_text'); ?></div>
<?php } else { ?>
<div id="wide"><?php the_field('box_text'); ?></div>
<?php } ?>
–
<?php $cf = get_fields(14); ?>
<div class="contact_details">
<img src="<?php bloginfo('template_url'); ?>/images/ico_tel.png" alt="Ikona telefon" />
<?php echo $cf['telefon']; ?>
<img src="<?php bloginfo('template_url'); ?>/images/ico_mail.png" alt="Ikona mail" />
<?php echo $cf['email']; ?>
<img src="<?php bloginfo('template_url'); ?>/images/ico_adr.png" alt="Ikoan adres" />
<?php echo $cf['adres']; ?>
</div>
—
TRUE/FALSE
<?php if( get_field('name', 'options')){ get_template_part('sidebar_box'); } ?>
—
Hope this helps and happy coding :)
Zobacz jeszcze
kod dla strony home
Wstawienie kodu odróżniającego stronę home od pozostałych podstron - przydatne np kiedy nazwę strony chcemy mieć jako h1 na home page a jako p na pozostałych podstronach: <?php if...
Wordpress
html5
Znaczniki html5 oznaczone w poniższym wykazie kolorem: <!-- tekst --> - komentarz <!DOCTYPE> - typ dokumentu a - odnośnik do strony, elementu strony abbr - skrót słowny ,...