Skip to content

Instantly share code, notes, and snippets.

@cryptexvinci
Created August 3, 2022 06:23
Show Gist options
  • Select an option

  • Save cryptexvinci/b0e12b2636e430062d5ad1c7539cf96c to your computer and use it in GitHub Desktop.

Select an option

Save cryptexvinci/b0e12b2636e430062d5ad1c7539cf96c to your computer and use it in GitHub Desktop.

Revisions

  1. cryptexvinci created this gist Aug 3, 2022.
    24 changes: 24 additions & 0 deletions um-custom-checkbox-output.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    <?php

    add_filter( "um_view_field_value_checkbox", "my_um_view_field_value_checkbox", 10, 2 );

    function my_um_view_field_value_checkbox( $html, $data ) {

    if ( $data['metakey'] != 'your_checkbox_meta_key' ) {
    return $html;
    }

    $html = um_filtered_value( $data['metakey'], $data );
    $html_array = explode( ',', $html );
    $html_array = array_map( 'trim', $html_array );
    $html = '<ul></ul>';

    foreach ( $html_array as $item ) {
    $html .= '<li>' . $item . '</li>';
    }

    $html .= '</ul>';

    return $html;
    }