Thanks, that’s done.
I would like to get each value its own color.
Like:
Café = red
Restaurang = blue
Bar = black
Gårdsbutik = grey
Sorry, do not have a clue.
I’m not so good at this so deep encoding so I have more or less just cut in and tested all possible variants without really understanding what I do.
I would like to do the following
It is a result list.
First I want to retrieve a user if there is one.
If not, I want to retrieve a relationship that is a custom post type named forare (drivers).
Then I want to get the results that are sub fields and that’s just the ones I’ve got it right. 🙂
Thanks. I have tested all the examples on the page and also a relationship that I have on another page without repeaters. But I get no work. This is how my last attempt looks.
<?php if( have_rows('resultat_2015_r1') ): ?>
<ul class="slides">
<?php while( have_rows('resultat_2015_r1') ): the_row();
// vars
$image = get_sub_field('image');
$content = get_sub_field('content');
$link = get_sub_field('link');
the_sub_field('resultat_r1_placering');
the_sub_field('resultat_r1_poang');
/*
* Query posts for a relationship value.
* This method uses the meta_query LIKE to match the string "123" to the database value a:1:{i:0;s:3:"123";} (serialized array)
*/
$forare = get_posts(array(
'post_type' => 'forare',
'meta_query' => array(
array(
'key' => 'tavlingsforare_post', // name of custom field
'value' => '"' . get_the_ID() . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
)
)
));
?>
<?php if( $forare ): ?>
<ul>
<?php foreach( $forare as $forare ): ?>
<li>
<a href="<?php echo get_permalink( $forare->ID ); ?>">
<?php echo get_the_title( $forare->ID ); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif;
?>
<li class="slide">
<?php if( $link ): ?>
<a href="<?php echo $link; ?>">
<?php endif; ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" />
<?php if( $link ): ?>
</a>
<?php endif; ?>
<?php echo $content; ?> innehåll - tavlingsforare_post
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
Have you found a solution?
Found a solution. 🙂
http://support.advancedcustomfields.com/forums/topic/acf-form-error-messages/
Hi Giu Tae Kim!
“If someone is interested I’ll try to explain the basics…”
Please do.
I know there are a couple of years ago but I hope you see that I respond and you still remember how you did. 🙂
I can the base in some of the coding, but most cut and paste until it works.
I have not really understood how I should begin. I mix of knowledge from the search form and WP_Query.
Grateful for answers.
Best wishes Elle
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.