Well, I found a solution using Wysiwyg Editor
Content. I add a media from the button provided and it works…
Hi,
i found the soluce :
$the_query_map = new WP_Query( array( 'post_type' => 'vignerons', 'posts_per_page' => -1, 'order' => 'ASC', 'orderby' => 'menu_order' ) );
if($the_query_map->have_posts()) :
while($the_query_map->have_posts()):
$the_query_map->the_post();
$the_ID = get_the_ID();
$link_vignerons = get_the_permalink();
$get_google_map = get_field('carte', $value);
$title_vignerons = get_the_title();
$output_map[$the_ID]['map'] = '<div class="marker" data-lat="'.$get_google_map['lat'].'" data-lng="'.$get_google_map['lng'].'"
<h4><a href="'.$link_vignerons.'" rel="bookmark"> '.$title_vignerons.'</a></h4></div>';
endwhile; endif;
wp_reset_postdata();
?><div class="acf-map"><?php
foreach( $output_map as $key => $map_marker ):
echo $map_marker['map'];
endforeach;
?>
</div>
Hope this help someone!
Hi,
I found this code and I adapted it to my needs, it works! How to add a link to the single.php of each person who appears on the map?
$the_query_map = new WP_Query( array( 'post_type' => 'vignerons', 'posts_per_page' => -1, 'order' => 'ASC', 'orderby' => 'menu_order' ) );
if($the_query_map->have_posts()) :
while($the_query_map->have_posts()):
$the_query_map->the_post();
$the_ID = get_the_ID();
$link_vignerons = get_the_permalink();
$get_google_map = get_field('carte', $value);
$output_map[$the_ID]['map'] = '<div class="marker" data-lat="'.$get_google_map['lat'].'" data-lng="'.$get_google_map['lng'].'"></div>';
endwhile; endif;
wp_reset_postdata();
?><div class="acf-map"><?php
foreach( $output_map as $key => $map_marker ):
echo $map_marker['map'];
endforeach;
?>
</div>
Thanks for help!
Hello, i found a solution, here is the code in the page:
$video = get_field('video_youtube');
if (!empty($video)){
echo video_iframe_YT($video);
echo '<iframe width="560" height="315" src="' . $video . '" frameborder="0" allowfullscreen></iframe>';
}
and the functiun :
// VIDEO YT : iframe
function video_iframe_YT($video_url)
{
$video_iframe = '';
// -----------------
if( !empty($video_url))
{
$video_url = video_cleanURL_YT($video_url);
$video_iframe = '<iframe width="560" height="315" src="' . $video_url . '" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>';
}
// -----------------
return $video_iframe;
};
?>
I hope it will help someone!
Hi,
thanks for reply!
unfortunately, I use a free version of ACF (V4.4) and I don’t have Oembed Field.
A plugin exist to add Oembed field, but it doesn’t work.
I know that I can do that I want with the version 5 of ACF, but it’s not free…
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.