webamies
Respuestas de foro creadas
Viendo 3 respuestas - de la 1 a la 3 (de un total de 3)
-
Foro: WordPress Avanzado
En respuesta a: CMB2 repeatable group field metaboxLGrusin Gracias por tu comentario,
Ahora estoy intentado con el mismo ejemplo de la documentación, y sigo sin recuperar los datos.=============== Metabox =================
add_action( 'cmb2_admin_init', 'sanidad_register_repeatable_group_field_metabox' ); /** * Hook in and add a metabox to demonstrate repeatable grouped fields */ function sanidad_register_repeatable_group_field_metabox() { $prefix = 'sanidad_group_'; /** * Repeatable Field Groups */ $cmb_group = new_cmb2_box( array( 'id' => $prefix . 'metabox', 'title' => esc_html__( 'Repeating Field Group', 'cmb2' ), 'object_types' => array( 'post', 'farmacias' ), // Post type ) ); // $group_field_id is the field id string, so in this case: $prefix . 'demo' $group_field_id = $cmb_group->add_field( array( 'id' => $prefix . 'demo', 'type' => 'group', 'description' => esc_html__( 'Generates reusable form entries', 'cmb2' ), 'options' => array( 'group_title' => esc_html__( 'Entry {#}', 'cmb2' ), // {#} gets replaced by row number 'add_button' => esc_html__( 'Add Another Entry', 'cmb2' ), 'remove_button' => esc_html__( 'Remove Entry', 'cmb2' ), 'sortable' => true, // 'closed' => true, // true to have the groups closed by default ), ) ); /** * Group fields works the same, except ids only need * to be unique to the group. Prefix is not needed. * * The parent field's id needs to be passed as the first argument. */ $cmb_group->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Entry Title', 'cmb2' ), 'id' => 'title', 'type' => 'text', // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) ) ); $cmb_group->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Description', 'cmb2' ), 'description' => esc_html__( 'Write a short description for this entry', 'cmb2' ), 'id' => 'description', 'type' => 'textarea_small', ) ); $cmb_group->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Entry Image', 'cmb2' ), 'id' => 'image', 'type' => 'file', ) ); $cmb_group->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Image Caption', 'cmb2' ), 'id' => 'image_caption', 'type' => 'text', ) ); }
================ Codigo de recuparción de datos ====================
<?php if(have_posts()): while(have_posts()): the_post(); $entries = get_post_meta( get_the_ID(), 'demo', true ); foreach ( (array) $entries as $key => $entry ) { $img = $title = $desc = $caption = ''; if ( isset( $entry['title'] ) ) { $title = esc_html( $entry['title'] ); } if ( isset( $entry['description'] ) ) { $desc = wpautop( $entry['description'] ); } if ( isset( $entry['image_id'] ) ) { $img = wp_get_attachment_image( $entry['image_id'], 'share-pick', null, array( 'class' => 'thumb', ) ); } $caption = isset( $entry['image_caption'] ) ? wpautop( $entry['image_caption'] ) : ''; // Do something with the data } ?> <?php endwhile; else : ?> <h3>Sorry we could not find what you are looking for </h3> <?php endif; ?>
porfa ayudame.
un saludo,
Foro: Guías – Resolución de problemas
En respuesta a: menu simpleGracias!!!!
Foro: Diseño – Temas y plantillas
En respuesta a: diferentes imágenes en la cabezada cada páginaGracias tu ayuda.
sabes me siento bien en Joomla, pero estoy viendo que todo el mundo desarrollo con WordPress.
Llevo casi una semana con wordpress y es muy interesante y no quiero usar los template free.de todo lo modo una vez gracias.
un saludo,
Viendo 3 respuestas - de la 1 a la 3 (de un total de 3)