Created
March 20, 2019 07:54
-
-
Save yuriy-yarvinen/96b7c9a1a783d119bda23f1dccfbca48 to your computer and use it in GitHub Desktop.
wp fields conection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$id = get_the_ID(); | |
$posts = get_posts( array('post_type'=>'postTypeName','numberposts' => 500,) ); | |
$i=0; | |
foreach( $posts as $post ){ | |
$fields = get_field('fieldName',$post->ID); | |
if($fields){ | |
foreach ($fields as $field) { | |
if($id == $field->ID){?> | |
<?php $img_team = get_field('image'); ?> | |
<div class="team"> | |
<div class="specialists-wrapper-services"> | |
<a href="<?php the_permalink() ?>"> | |
<div class="specialist"> | |
<div class="img"> | |
<img src="<?=$img_team['url']; ?>" alt="<?=$img_team['alt']; ?>" /> | |
</div> | |
<div class="text"> | |
<span class="fio"><?php the_title(); ?></span> | |
<span class="dolzhnost"><?php the_field('post'); ?></span> | |
</div> | |
</div> | |
</a> | |
</div> | |
</div> | |
<?$i++;} | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment