Hi,
sorry it’s my first topic 🙂
Maybe it will be clearer with proper code.
So, first, I have a CPT for courses.
In that CPT, I use ACF for the details of the courses.
One of the field is a repeater field : each course cans have multiple group (each group have a different start time and an URL to register).
On the courses page, I display the groups using the following code:
<?php if(have_rows('gestion_groupe')){ ?>
<div id="accordion">
<?php while (have_rows('gestion_groupe')): the_row(); ?>
<div>
<?php if (get_sub_field('fraisEQ') != NULL) { ?>
<div class="ligne"><span style="font-size:13px;"><strong>Groupe Emploi-Québec</strong> :
<?php echo get_sub_field('fraisEQ'); ?> $</span>
<button onclick="hiddenLinks('<?php the_sub_field('ns_lienMiaEQ'); ?>','<?php the_title(); ?>','<?php the_title(); ?>')" class="et_pb_button_mia">S'inscrire</button>
</div>
<?php
}
?>
</div>
<?php
endwhile;
?>
What I want here, is to display a button if there’s a group (get_sub_field…).
If the person click on the button, the popup will appears. I want to have the link in that pop-up. Each group have a different link…
My popup is an hidden div on the page :
<div id="overlay" onclick="off()">
<div id="overlayText">
[I have text...]
<a href="<?php echo the_sub_field('ns_lienMiaEQ'); ?>" class="et_pb_button_mia" target="_blank" id="miaLink">Button text</a>
And I’ve got a js function :
function hiddenLinks() {
document.getElementById("overlay").style.display = "block";
}
function off() {
document.getElementById("overlay").style.display = "none";
}
If it’s still unclear, let me know and thanks for the help.