To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
The technical storage or access that is used exclusively for statistical purposes.
The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
In the base plug in, the salary_type field generates 2 other fields (currency and amount) when its value equal 'fixed'. I have written a code in the same spirit but all fields are displayed at the same time and not conditionnaly. here is my code
/* Display job_type input field */
add_action('job_bm_job_submit_form', 'job_bm_job_submit_form_job_type', 30);
function job_bm_job_submit_form_job_type(){
$class_job_bm_functions = new class_job_bm_functions();
$job_type_list = $class_job_bm_functions->job_type_list();
$job_bm_job_type = isset($_POST['job_bm_job_type']) ? sanitize_text_field($_POST['job_bm_job_type']) : "";
?>
<div class="form-field-wrap">
<div class="field-title"><?php _e('Type d\'offre','job-board-manager'); ?></div>
<div class="field-input">
<select name="job_bm_job_type" >
<?php
if(!empty($job_type_list)):
foreach ($job_type_list as $job_type => $job_type_name){
$selected = ($job_bm_job_type == $job_type) ? 'selected' : '';
?>
<option <?php echo $selected; ?> value="<?php echo esc_attr($job_type); ?>"><?php echo esc_html
($job_type_name); ?></option>
<?php
}
endif;
?>
</select>
<p class="field-details"><?php _e('Que recherchez-vous en postant cette offre?','job-board-manager'); ?></p>
</div>
</div>
<style type="text/css">
<?php
if($job_bm_job_type =='fusion'){
?>
.montant_a_lever, .montant_de_cession, .nombre_associes, .montant_currency{
display: none;
}
<?php
}elseif ($job_bm_job_type =='Partenariat'){
?>
.montant_a_lever, .montant_de_cession, .montant_currency{
display: none;
}
<?php
}elseif ($job_bm_job_type =='associer'){
?>
.montant_a_lever, .montant_de_cession, .montant_currency{
display: none;
}
<?php
}elseif ($job_bm_job_type =='vendre-son-affaire'){
?>
.montant_a_lever, .nombre_associes{
display: none;
}
<?php
}elseif ($job_bm_job_type =='levee-de-fonds'){
?>
.montant_de_cession, .nombre_associes{
display: none;
}
<?php
}
?>
</style>
<?php
}
add_action('job_bm_job_submit_form', 'job_bm_job_submit_form_montant_a_lever', 30);
function job_bm_job_submit_form_montant_a_lever(){
$job_bm_montant_a_lever = isset($_POST['job_bm_montant_a_lever']) ? sanitize_text_field($_POST['job_bm_montant_a_lever']) : "";
$job_bm_job_type = isset($_POST['job_bm_job_type']) ? sanitize_text_field($_POST['job_bm_job_type']) : "";
?>
<div class="form-field-wrap montant_a_lever" <?php if($job_bm_job_type =='levee-de-fonds'): ?> style="display: block" <?php endif; ?>>
<div class="field-title"><?php _e('Montant à lever','job-board-manager'); ?></div>
<div class="field-input">
<input placeholder="<?php echo __('50000','job-board-manager'); ?>" type="text" value="<?php echo $job_bm_montant_a_lever; ?>" name="job_bm_montant_a_lever">
<p class="field-details"><?php _e('Indiquez le montant que vous souhaiter lever, ex: 1200','job-board-manager');
?></p>
</div>
</div>
<?php
}
add_action('job_bm_job_submit_form', 'job_bm_job_submit_form_montant_de_cession', 30);
function job_bm_job_submit_form_montant_de_cession(){
$job_bm_montant_de_cession = isset($_POST['job_bm_montant_de_cession']) ? sanitize_text_field($_POST['job_bm_montant_de_cession']) : "";
$job_bm_job_type = isset($_POST['job_bm_job_type']) ? sanitize_text_field($_POST['job_bm_job_type']) : "";
?>
<div class="form-field-wrap montant_de_cession" <?php if($job_bm_job_type =='vendre-son-affaire'): ?> style="display: block" <?php endif; ?>>
<div class="field-title"><?php _e('Prix de vente','job-board-manager'); ?></div>
<div class="field-input">
<input placeholder="<?php echo __('50000','job-board-manager'); ?>" type="text" value="<?php echo $job_bm_montant_de_cession; ?>" name="job_bm_montant_de_cession">
<p class="field-details"><?php _e('Indiquez le prix auquel vous souhaiter vendre, ex: 1200','job-board-manager');
?></p>
</div>
</div>
<?php
}
add_action('job_bm_job_submit_form', 'job_bm_job_submit_form_nombre_associes', 30);
function job_bm_job_submit_form_nombre_associes(){
$job_bm_nombre_associes = isset($_POST['job_bm_nombre_associes']) ? sanitize_text_field($_POST['job_bm_nombre_associes']) : "";
$job_bm_job_type = isset($_POST['job_bm_job_type']) ? sanitize_text_field($_POST['job_bm_job_type']) : "";
?>
<div class="form-field-wrap nombre_associes" <?php if($job_bm_job_type =='associer'): ?> style="display: block" <?php endif; ?>>
<div class="field-title"><?php _e('Nombre d\'associés','job-board-manager'); ?></div>
<div class="field-input">
<input placeholder="<?php echo __('3','job-board-manager'); ?>" type="text" value="<?php echo $job_bm_nombre_associes; ?>" name="job_bm_nombre_associes">
<p class="field-details"><?php _e('Indiquez le nombre d\'associés recherchés pour cette offre, ex: 2','job-board-manager');
?></p>
</div>
</div>
<?php
}
add_action('job_bm_job_submit_form', 'job_bm_job_submit_form_montant_currency', 30);
function job_bm_job_submit_form_montant_currency(){
$job_bm_montant_currency = isset($_POST['job_bm_montant_currency']) ? sanitize_text_field($_POST['job_bm_montant_currency']) : "";
?>
<div class="form-field-wrap montant_currency" >
<div class="field-title"><?php _e('Devise','job-board-manager'); ?></div>
<div class="field-input">
<input placeholder="<?php echo __('USD','job-board-manager'); ?>" type="text" value="<?php echo $job_bm_montant_currency; ?>" name="job_bm_montant_currency">
<p class="field-details"><?php _e('choisissez la devise du montant indiqué, ex: USD','job-board-manager');
?></p>
</div>
</div>
<?php
}