Compare commits

..

No commits in common. "5c9476cb617c60aa1337110bf2a05e65b06668e7" and "7fdbf867ca7a86bd0831031c038bfd86787ddd24" have entirely different histories.

4 changed files with 18 additions and 37 deletions

View File

@ -1,16 +1,12 @@
<?php
// Apply the filter to multiple hooks to ensure choices are available during render, validation, and submission
add_filter('gform_pre_render', 'populate_taxonomy_terms');
add_filter('gform_pre_validation', 'populate_taxonomy_terms');
add_filter('gform_pre_submission_filter', 'populate_taxonomy_terms');
add_filter('gform_admin_pre_render', 'populate_taxonomy_terms');
function populate_taxonomy_terms($form)
{
// Specify the form ID and the ID of the select field
$form_id = 2;
$field_id = 16;
$field_id = 15;
// Check if the current form matches the specified form ID
if ($form['id'] == $form_id) {
@ -20,39 +16,20 @@ function populate_taxonomy_terms($form)
'hide_empty' => false, // Include empty terms
));
// Find the checkbox field by ID
// Prepare choices array for the select field
$choices = array();
foreach ($terms as $term) {
$choices[] = array(
'text' => $term->name,
'value' => $term->term_id,
);
}
// Find the select field by ID
foreach ($form['fields'] as &$field) {
if ($field->id == $field_id) {
// Prepare choices and inputs array for checkboxes
$choices = array();
$inputs = array();
$index = 1;
foreach ($terms as $term) {
$choices[] = array(
'text' => $term->name,
'value' => $term->name, // Use term name as value for display
'isSelected' => false,
);
// For checkboxes, each choice needs a corresponding input
$inputs[] = array(
'id' => $field->id . '.' . $index,
'label' => $term->name,
'name' => '',
);
$index++;
}
// Update choices and inputs for the checkbox field
// Update choices for the select field
$field->choices = $choices;
$field->inputs = $inputs;
// Ensure the field is not marked as administrative only
$field->adminOnly = false;
break;
}
}

View File

@ -41,7 +41,9 @@ $revueID = get_field('related_revue', get_the_ID());
<?php get_template_part('template-parts/articles/article-content', null, array(
'ID' => get_the_ID()
)); ?>
</div>
</div>
<!-- #### RECOMMANDATIONS #### -->

View File

@ -15,6 +15,8 @@ $articlesAmount = get_author_articles_amount($author_id);
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="page--single-auteurs__header">
<div class="inner container">

View File

@ -24,9 +24,9 @@
<img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-rechercher.svg" alt="Rechercher">
</button>
<a class="subscribe-button" href="<?php echo home_url(); ?>/infolettre">
<button class="subscribe-button">
<img src="<?php echo get_template_directory_uri(); ?>/resources/img/icons/carhop-abonner.svg" alt="Sabonner">
</a>
</button>
</div>
</div>
</div>