Viewing 5 replies - 1 through 5 (of 5 total)
  • Have you figured this out?

    I found a solution but I don’t thinks its the proper one.

    $meta_text = rwmb_meta( 'kd_fname');
    
        if( !empty( $meta_text ) ) {
            foreach ($meta_text as $key) {
        	echo $key;
        }
    
        }
    Plugin Author Anh Tran

    (@rilwis)

    Hi, if field has multiple value and you use echo, you will see array.

    To fix that, you can use code:

    $values = rwmb_get_field( 'field_id' ); // rwmb_get_value is new function added in 4.5
    foreach ( $values as $value )
    {
        echo $value;
    }
    Thread Starter glasshat

    (@glasshat)

    Thanks guys – got this sorted now 🙂

    On another point – do you know of an easy solution so that editors can write within the wysiwyg in Markdown but display as parsed in the front end?

    So far I can only do this with the main post editor (via Jetpack).

    Thanks

    Sam

    Plugin Author Anh Tran

    (@rilwis)

    If you’re using Jetpack, you can use its code to transform Markdown text to HTML. The idea is similar to this:

    $markdown_text = rwmb_get_field( 'field_id' );
    $html = WPCom_Markdown::get_instance()->transform( $markdown_text );

    For more info, please read the code of Jetpack Markdown module.

    Sorry for bumping this old threat, but my problem is the same (I guess). The solutions posted here don’t work.

    This is my array:

    // CHECKBOX LIST
    			array(
    				'name'    => __( 'Genres', 'your-prefix' ),
    				'id'      => "{$prefix}checkbox_list",
    				'type'    => 'checkbox_list',
    				// Options of checkboxes, in format 'value' => 'Label'
    				'options' => array(
    					'value1' => __( 'Actie', 'your-prefix' ),
    					'value2' => __( 'Animatie', 'your-prefix' ),
    					'value3' => __( 'Avontuur', 'your-prefix' ),
    					'value4' => __( 'Comedy', 'your-prefix' ),
    					'value5' => __( 'Crime', 'your-prefix' ),
    					'value6' => __( 'Detective', 'your-prefix' ),
    					'value7' => __( 'Drama', 'your-prefix' ),
    					'value8' => __( 'Fantasy', 'your-prefix' ),
    					'value9' => __( 'Horror', 'your-prefix' ),
    					'value10' => __( 'Musical', 'your-prefix' ),
    					'value11' => __( 'Sci-fi', 'your-prefix' ),
    					'value12' => __( 'Thriller', 'your-prefix' ),
    					'value13' => __( 'Western', 'your-prefix' ),
    				),

    I’m using this to output the selected checkboxes:

    $values = rwmb_get_field( 'your_prefix_checkbox_list' ); // rwmb_get_value is new function added in 4.5
    foreach ( $values as $value )
    {
        echo $value;
    }

    Unfortunately, this outputs something like this: “value6value7value12”. What am I doing wrong?
    Many thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Meta Boxes not displaying in the front end’ is closed to new replies.