简体   繁体   中英

how to use text editor in SMOF (wordpress)

I tried this but, it doesn't shows the text editor. so, how can i get text editor field in SMOF??

$of_options[] = array(  "name"      => "Legal Services",
                        "desc"      => "Upload Here content",
                        "id"        => "legal",
                        // Use the shortcodes [site_url] or [site_url_secure] for setting default URLs
                        "std"       => "",
                        "mod"       => "min",
                        "type"      => "text"
                );

Please post more details, what version are you using?

Change:

"type"      => "text"

to:

'type' => 'editor'

Add following to your class.options_machine.php in the switch at row 157

//Wp editor input
case 'editor':

    $editor_value = '';

    if(isset($value['options']) && is_array($value['options']) ){
        $settings = $value['options'];
    } else {
        $settings = array();
    }           

    $editor_value = stripslashes($smof_data[$value['id']]);

    // Turn on the output buffer
    ob_start();

    // Echo the editor to the buffer
    wp_editor( $editor_value, $value['id'], $settings = array() );

    // Store the contents of the buffer in a variable
    $editor_contents = ob_get_clean();

    $output .= $editor_contents;

    break;

Since wp_editor() function echoes as default a way around it is to put it inside a buffer and then get the contents from it.

This is at least a start,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM