Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey!

    Check this link, it’s a step by step guide on installing SSL Certs on nginx enviroments.

    https://www.digitalocean.com/community/tutorials/how-to-install-an-ssl-certificate-from-a-commercial-certificate-authority

    Thread Starter wlaedimir

    (@wlaedimir)

    I prefer to keep it private. I’ll contact you from there.

    Thanks.

    Thread Starter wlaedimir

    (@wlaedimir)

    This is what I found

    // Metaboxes para el resto del tema
    
    function gobcl_metaboxes( $meta_boxes ) {
        $prefix = '_gobcl_'; // Prefix for all fields
        $meta_boxes['field_group'] = array(
            'id'         => 'nodos_automaticos',
            'title'      => __( 'Nodos', 'gobcl' ),
            'pages'      => array( 'page', ),
            'cmb_styles' => true,
            'fields'     => array(
                array(
                    'id'          => $prefix . 'nodos_auto',
                    'type'        => 'group',
                    'description' => __( 'Creación simple de nodos de contenido', 'gobcl' ),
                    'options'     => array(
                        'group_title'   => __( 'Nodo N°{#}', 'gobcl' ), // {#} gets replaced by row number
                        'add_button'    => __( 'Añadir otro nodo', 'gobcl' ),
                        'remove_button' => __( 'Quitar nodo', 'gobcl' ),
                        'sortable'      => true, // beta
                    ),
                    // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
                    'fields'      => array(
                        array(
                            'name' => 'Titulo de Nodo',
                            'id'   => 'title',
                            'type' => 'text',
                            // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
                        ),
                        array(
                            'name' => 'Enlace a Página',
                            'id'   => 'link',
                            'type' => 'text',
                        ),
                        array(
                            'name' => 'Descripción o Párrafo para nodo',
                            'description' => 'Escriba una descripción para el contenido de este nodo',
                            'id'   => 'description',
                            'type' => 'wysiwyg',
                            'options' => array(
                                'media_buttons' => false,
                                'textarea_rows' => get_option('default_post_edit_rows', 3)
                            ),
                        ),
                        array(
                            'name' => 'Imagen de cabecera de nodo',
                            'description' => 'Añada una imagen para la cabecera del nodo',
                            'id'   => 'image',
                            'type' => 'file',
                        ),
                        array(
                            'name' => 'Embedir un enlace',
                            'desc' => 'Ingrese una URL de youtube, twitter, o instagram. Soporta los servicios enlistados en <a href="http://codex.ww.wp.xz.cn/Embeds">http://codex.ww.wp.xz.cn/Embeds</a>.',
                            'id' => 'embed',
                            'type' => 'oembed',
                        ),
                        array(
                            'name' => 'Subnodo N°1',
                            'desc' => 'Nodos especiales para contenidos envueltos',
                            'id' => 'subnodo1',
                            'type' => 'wysiwyg',
                            'options' => array(
                                'media_buttons' => false,
                                'textarea_rows' => get_option('default_post_edit_rows', 3),
                                'teeny' => true
                            ),
                        ),
                        array(
                            'name' => 'Subnodo N°2',
                            'desc' => 'Nodos especiales para contenidos envueltos',
                            'id' => 'subnodo2',
                            'type' => 'wysiwyg',
                            'options' => array(
                                'media_buttons' => false,
                                'textarea_rows' => get_option('default_post_edit_rows', 3),
                                'teeny' => true
                            ),
                        ),
                        array(
                            'name' => 'Subnodo N°3',
                            'desc' => 'Nodos especiales para contenidos envueltos',
                            'id' => 'subnodo3',
                            'type' => 'wysiwyg',
                            'options' => array(
                                'media_buttons' => false,
                                'textarea_rows' => get_option('default_post_edit_rows', 3),
                                'teeny' => true
                            ),
                        ),
                        array(
                            'name' => 'Subnodo N°4',
                            'desc' => 'Nodos especiales para contenidos envueltos',
                            'id' => 'subnodo4',
                            'type' => 'wysiwyg',
                            'options' => array(
                                'media_buttons' => false,
                                'textarea_rows' => get_option('default_post_edit_rows', 3),
                                'teeny' => true
                            ),
                        ),
                    ),
                ),
            ),
        );
    
        return $meta_boxes;
    }
    
    add_filter( 'cmb_meta_boxes', 'gobcl_metaboxes' );
    
    add_action( 'init', 'cmb_initialize_cmb_meta_boxes', 9999 );
    /**
     * Initialize the metabox class.
     */
    function cmb_initialize_cmb_meta_boxes() {
    
        if ( ! class_exists( 'cmb_Meta_Box' ) )
            require_once 'lib/metabox/init.php';
    }

    If this isn’t enough I can send you the file. In the fields, I replaced the grpup field array that wasn’t working. It was supposed to build this “Subnodo” elements.

    Thread Starter wlaedimir

    (@wlaedimir)

    No, I didn’t, in fact, my boss said that it was better to let it aside, so I started to work on other things. So, I still can check this to see if we can get a solution for the other users right?

    Which is the action hook? and the callback? I mean, where can I find them, in the pages where the outputs for this function must be shown?

    Thread Starter wlaedimir

    (@wlaedimir)

    yeah, this is the code Michael

    $meta_boxes['field_group'] = array(
            'id'         => 'nodos_automaticos',
            'title'      => __( 'Nodos', 'gobcl' ),
            'pages'      => array( 'page', ),
            'cmb_styles' => true,
            'fields'     => array(
                array(
                    'id'          => $prefix . 'nodos_auto',
                    'type'        => 'group',
                    'description' => __( 'Creación simple de nodos de contenido', 'gobcl' ),
                    'options'     => array(
                        'group_title'   => __( 'Nodo N°{#}', 'gobcl' ), // {#} gets replaced by row number
                        'add_button'    => __( 'Añadir otro nodo', 'gobcl' ),
                        'remove_button' => __( 'Quitar nodo', 'gobcl' ),
                        'sortable'      => true, // beta
                    ),
                    // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
                    'fields'      => array(
                        array(
                            'name' => 'Titulo de Nodo',
                            'id'   => 'title',
                            'type' => 'text',
                            // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
                        ),
                        array(
                            'name' => 'Descripción o Párrafo para nodo',
                            'description' => 'Escriba una descripción para el contenido de este nodo',
                            'id'   => 'description',
                            'type' => 'textarea_small',
                        ),
                        array(
                            'name' => 'Imagen de cabecera de nodo',
                            'description' => 'Añada una imagen para la cabecera del nodo',
                            'id'   => 'image',
                            'type' => 'file',
                        ),
                        array(
                            'name' => 'Subtítulo para foto',
                            'id'   => 'image_caption',
                            'type' => 'text',
                        ),
                        array(
                            'name' => 'Embedir un enlace',
                            'desc' => 'Ingrese una URL de youtube, twitter, o instagram. Soporta los servicios enlistados en <a href="http://codex.ww.wp.xz.cn/Embeds">http://codex.ww.wp.xz.cn/Embeds</a>.',
                            'id' => 'embed',
                            'type' => 'oembed',
                        ),
                        array(
                            'name' => 'Añadir un Subnodo',
                            'desc' => 'Añade un subnodo con información "envuelta"',
                            'id' => 'subnodo',
                            'type' => 'textarea_small',
                            'repeatable' => true,
                        ),
                    ),
                ),
            ),

    ^that’s the code that’s on the functions.php… and the the last array is the code for the repeatable field

    Thread Starter wlaedimir

    (@wlaedimir)

    the console says

    TypeError: $self.data(...) is undefined

    everytime I press the “Add Row” button.

    And there’s another thing, how can I call those repeatable text on the template? Do I have to do another foreach to call the inner repeatable?

    You have to use this code in your template file

    <?php
    $entries = get_post_meta( get_the_ID(), $prefix . 'repeat_group', 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
    }
    ?>

    Then, you should print all the variables according how you want to display them in your template file.

    For example, after the foreach
    place something like this

    <div class="metabox">
    				          	<?php echo $img; ?>
    				          	<h3><?php echo $title; ?></h3>
    				            <p><?php echo $desc; ?></p>
    				            <p><?php echo $caption; ?></p>
    </div>
    <?php } ?>

    Hope this helps

Viewing 7 replies - 1 through 7 (of 7 total)