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

114
Views
Etiqueta de control de repetidor de Elementor desde una etiqueta de control seleccionada

Tengo un control REPETIDOR que tiene un control SELECCIONAR que se usa para seleccionar una página de WordPress. Quiero asegurarme de que la etiqueta del repetidor sea el título de la página. Mi secuencia de comandos devuelve un objeto Javascript en lugar del título de la página. Aquí está mi código:

` $page_list = \Core_Elementor_Extensions::core_get_pages();

 $page_list_json = json_encode($page_list); $repeater->add_control( 'posts_pages', [ 'label' => esc_html__('Pages', 'core'), 'type' => Controls_Manager::SELECT, 'options' => $page_list, 'label_block' => true, 'multiple' => false, ] ); $this->add_control( 'core_page_list', [ 'label' => __('Content', 'core'), 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'title_field' => "<# " . "let labels = #>" . $page_list_json . "<# ; " // Now the labels are available to the javascript . "let key =#>" . '{{ posts_pages }}' . "<# ;" . "let label = labels[key]; " . "#>" . "{{{ label }}}", ] );`

El {{{ label }}} devuelve {"11":"Page Title", "22":"Page Title 2"}88888 , el 8888 es en realidad el '{{ posts_pages }}' en el valor de the_field que estaba intentando tp pase como la CLAVE para acceder al objeto Js devuelto arriba.

No estoy muy familiarizado con las plantillas de subrayado js.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Aquí está la solución que funcionó:

 //Use Json Encode to convert array or object to JSON representation which will be like a javascript object $page_list_json = json_encode($page_list); //Get your array/object in my case pages $page_list_json = $page_list; $repeater->add_control( 'posts_pages', [ 'label' => esc_html__('Pages', 'core'), 'type' => Controls_Manager::SELECT, 'options' => $page_list, 'label_block' => true, 'multiple' => false, ] ); $this->add_control( 'core_page_list', [ 'label' => __('Content', 'core'), 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'title_field' => "<# " . "let labels = $page_list_json; " // Now the labels are available to the javascript . "let label = labels[posts_pages]; "// Get the value of the selected page . "#>" . "{{{ label }}}",//Show the value at the repeater title section ] );
about 4 years ago · Juan Pablo Isaza Report
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!