2017-08-12 4 views
1

Voici le code complet du Widget →WordPress Widget boutons radio n'épargnent pas → Seulement avec PHP sans Js/JQuery

 <p> <input type="radio" <?php checked( $instance[ 'what_to_check_for' ], 'check_for_counter'); ?> id="<?php echo $this->get_field_id('check_for_counter'); ?>" value="check_for_counter" name="what_to_check_for" /> 
     <label for="<?php echo $this->get_field_id('check_for_counter'); ?>">Check whether to display description or not</label> </p> 

     <p> <input type="radio" <?php checked($instance[ 'what_to_check_for' ], 'check_for_image'); ?> id="<?php echo $this->get_field_id('check_for_image'); ?>" value="check_for_image" name="what_to_check_for" /> 
     <label for="<?php echo $this->get_field_id('check_for_image'); ?>">Select to Post with Thumbnails</label> </p> 

Le problème →

le problème est que le bouton radio ne sauve pas . Je joins un enregistrement vidéo ci-dessous pour cela. le bouton radio ne se sauvé → https://www.screencast.com/t/pLad8AwrOXiS

S'il vous plaît me guider là où je me trompe. Est-ce que isset est absent pour ce bouton radio ? Si oui, alors aidez-moi à finir ça.

+0

Y a-t-il quelqu'un pour m'aider? – somethingnow

+1

as-tu essayé avec js? – vel

+0

merci de demander, mais je ne sais pas Js, et je sais que cela pourrait être réalisé avec PHP – somethingnow

Répondre

1

Essayez ce code. Ça marche.

  <p> <input type="radio" class="what_to_check_for" <?php checked($what_to_check_for ,'check_for_counter'); ?> id="<?php echo $this->get_field_id('check_for_counter'); ?>" value="check_for_counter" name="<?php echo $this->get_field_name('what_to_check_for'); ?>" > 
      <label for="<?php echo $this->get_field_id('check_for_counter'); ?>">Check whether to display description or not</label> </p> 

      <p> <input type="radio" class="what_to_check_for" <?php checked($what_to_check_for ,'check_for_image'); ?> id="<?php echo $this->get_field_id('check_for_image'); ?>" value="check_for_image" name="<?php echo $this->get_field_name('what_to_check_for'); ?>" > 
      <label for="<?php echo $this->get_field_id('check_for_image'); ?>">Select to Post with Thumbnails</label> </p> 
+0

Veuillez mettre à jour votre réponse sans JS/JQuery, mais seulement PHP ou supprimer la solution. – somethingnow

+1

js enlevé. S'il vous plaît vérifier et laissez-moi savoir – vel

+1

cela fonctionne très bien sans js – vel