Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
formulario de contacto 7 cuerpo de correo con CodeMirror y TinyMCE

Intento agregar wp_enqueue_code_editor (codemirror) y wp_editor (tinymce) en el cuerpo del correo del editor y cambio entre ellos a través de la casilla de verificación "Usar tipo de contenido HTML".

tinymce conectado a la forma

 add_action( 'admin_enqueue_scripts', 'cf7_email_editor_scripts' ); function cf7_email_editor_scripts(){ if( isset( $_GET['page'], $_GET['post'] ) ){ if( $_GET['page'] == 'wpcf7' ){ wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'wp-tinymce' ); wp_enqueue_script( 'editor_js', admin_url('js/editor.js'), array(), false, true ); wp_enqueue_script( 'cf7_email_editor', plugin_dir_url( __FILE__ ) . '/tinymce-init.js', array(), 1, true ); wp_enqueue_style( 'tinymce_css', includes_url('css/editor.css') ); } } }

trabajo de cambio de html a través de js

 jQuery( document ).ready(function($){ $(window).on('load', function(){ init_cf7ee_tinyMCE(); }); $('#wpcf7-mail-use-html, #wpcf7-mail-2-use-html').change(function(event) { init_cf7ee_tinyMCE(); }); }); function init_cf7ee_tinyMCE(){ tinyMCE.remove(); var tinymce_elements = []; if( jQuery('#wpcf7-mail-use-html').prop('checked') ) tinymce_elements.push('wpcf7-mail-body'); if( jQuery('#wpcf7-mail-2-use-html').prop('checked') ) tinymce_elements.push('wpcf7-mail-2-body'); tinyMCE.init({ mode: 'exact', elements: tinymce_elements.join(','), menubar: true }); }

esta construcción funciona bien
tiene dos elementos: DIV tinymce y textarea wpcf7
y cambia entre ellos
pero si agrega wp_enqueue_code_editor aparece el tercer elemento DIV CodeMirror y tiny deja de cambiar

 add_action( 'admin_print_styles-toplevel_page_wpcf7', function () { $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); wp_add_inline_script('code-editor', sprintf( 'jQuery( function() { wp.codeEditor.initialize( "wpcf7-mail-body", %s ); } );', wp_json_encode( $settings ) )); wp_add_inline_script('code-editor', sprintf( 'jQuery( function() { wp.codeEditor.initialize( "wpcf7-mail-2-body", %s ); } );', wp_json_encode( $settings ) )); } );

alguien puede tener un "formulario de contacto 7" cerca y decirme cual es mi error

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!