Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » WordPress »

Uso del 'register_setting' para varias opciones de pagina

Estas en el tema de Uso del 'register_setting' para varias opciones de pagina en el foro de WordPress en Foros del Web. Hola quiero que me ayuden en un duda sobre register_setting de wordpress. Tengo varias paginas de administración en la plantilla que estoy creando, pero cada ...
  #1 (permalink)  
Antiguo 09/11/2013, 19:48
Avatar de ilen  
Fecha de Ingreso: febrero-2009
Mensajes: 125
Antigüedad: 15 años, 1 mes
Puntos: 2
Pregunta Uso del 'register_setting' para varias opciones de pagina

Hola quiero que me ayuden en un duda sobre register_setting de wordpress.

Tengo varias paginas de administración en la plantilla que estoy creando, pero cada pagina tengo que registrar un register_setting para que me devuelva los valores de la pagina es decir si estoy en la pagina de general de la configuracion del template tengo esto
Código PHP:
Ver original
  1. register_setting( 'clearly_theme_options_general', 'clearly_theme_options_general' );
  2.  
  3. add_settings_section(
  4.         'clearly_general_section',          // ID used to identify this section and with which to register options
  5.         '',                                 // Title to be displayed on the administration page
  6.         'clearly_general_callback',         // Callback used to render the description of the section
  7.         'clearly-general-option'            // Page on which to add this section of options
  8.     );
  9.  
  10.     add_settings_field(
  11.         'slider-type',                              // ID used to identify the field throughout the theme
  12.         'Homepage Slider Type',                     // The label to the left of the option interface element
  13.         'clearly_slider_type_callback',             // The name of the function responsible for rendering the option interface
  14.         'clearly-general-option',           // The page on which this option will be displayed
  15.         'clearly_general_section',                  // The name of the section to which this field belongs
  16.         array(                                      // The array of arguments to pass to the callback. In this case, just a description.
  17.             'Choose the type of posts the homepage featured slider displays..',
  18.             'Text number 2'
  19.         )
  20.     );

Ahora si estoy en la de Colores tengo esta

Código PHP:
Ver original
  1. register_setting( 'clearly_theme_options_colors', 'clearly_theme_options_colors' );
  2.  
  3.     add_settings_section(
  4.         'clearly_colors_section',           // ID used to identify this section and with which to register options
  5.         '',                                 // Title to be displayed on the administration page
  6.         'clearly_colors_callback',          // Callback used to render the description of the section
  7.         'clearly-color-option'              // Page on which to add this section of options
  8.     );
  9.  
  10.     add_settings_field(
  11.         'color_global_accent',                              // ID used to identify the field throughout the theme
  12.         'Global Accent Color',                  // The label to the left of the option interface element
  13.         'clearly_color_global_accent_callback',                 // The name of the function responsible for rendering the option interface
  14.         'clearly-color-option',         // The page on which this option will be displayed
  15.         'clearly_colors_section',                   // The name of the section to which this field belongs
  16.         array(                                      // The array of arguments to pass to the callback. In this case, just a description.
  17.             'Enter any text you want to be output to the footer.',
  18.             ''
  19.         )
  20.     );

entonces cada vez que voy llamar a la opciones del template de la primera pagina de opciones tengo hacer esto
Código PHP:
Ver original
  1. get_option('clearly_theme_options_general');

y si quiero llamar alguna funcion registrada de color
Código PHP:
Ver original
  1. get_option('clearly_theme_options_colors');

hasta alli todo me funciona bien, pero quiero es tener todas los campos en un solo register_setting, no se como hacerlo...

por ejemplo que tan solo con llamar el
Código PHP:
Ver original
  1. <?php get_option('clearly_theme_options') ?>
me devuelva todos los valores del template que tengo en varios register_setting

Etiquetas: opciones, php, post, theme
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:08.