Viewing 1 replies (of 1 total)
  • Thread Starter Tche111

    (@tche111)

    OK, I finally made it following this crystal clear tut’: http://ivetetecedor.com/how-to-use-a-drop-down-menu-for-wordpress-custom-fields

    Consequently, my functions.php became:

    add_action( 'comment_form_logged_in_after', 'additional_fields' ); add_action( 'comment_form_after_fields', 'additional_fields' );
    
    function additional_fields () { echo ''. '' . __( 'Titre (Je peux...)' ) . ''. '
    ';
    
    echo 'Cette solution est particulièrement utile... Dans tous les cas Sans argent Sans le temps Sans la santé ';
    
    }
    
    add_action( 'comment_post', 'save_comment_meta_data' ); function save_comment_meta_data( $comment_id ) { if ( ( isset( $_POST['title'] ) ) && ( $_POST['title'] != '') ) $title = wp_filter_nohtml_kses($_POST['title']); add_comment_meta( $comment_id, 'title', $title ); if ( ( isset( $_POST['category'] ) ) && ( $_POST['category'] != '') ) $category = wp_filter_nohtml_kses($_POST['category']); add_comment_meta( $comment_id, 'category', $category );
    
    }

    I hope it’ll help

Viewing 1 replies (of 1 total)
  • The topic ‘How to change a custom field into a dropdown list?’ is closed to new replies.