Okay
  Public Ticket #1269604
Custom metaboxes and avatar icon change
Open

Comments

  • mihai started the conversation

    Issues:

    1. Regarding Custom Metaboxes created as new listing steps, we want to change the appearance order of them but for an unknown reason this is not allowed. Also here if the fields in those metaboxes  are filled the information is not saved.

    2. We want to change that default avatar Icon on the meniu with another one. Here also we have an error.

    Bellow is what my designer informed me:

    A. New metabox with new fields, and rearrange metaboxes

    We use this code to add a new metaboxes (evenimente_articole_metabox) on listing type "eveniment"

    add_action( 'cmb2_init', 'evenimente_articole_metabox' );

    function evenimente_articole_metabox() {
        $details_metabox = new_cmb2_box( array(
            'id'            => INVENTOR_LISTING_PREFIX . 'evenimente_articole',
            'title'         => __( 'Articole', 'domain' ),
            'object_types'  => array( 'eveniment' ),
            'context'       => 'normal',
            'priority'      => 'high',
            'skip'          => true
        ) );

        $details_metabox->add_field( array(
        'name'    => 'Primul articol',
        'desc'    => 'Articol de tip blog (optional)',
        'id'      => 'first_article',
        'type'    => 'wysiwyg',
        'options' => array(
            'wpautop' => true, // use wpautop?
            'media_buttons' => true, // show insert/upload button(s)
            'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
            'textarea_rows' => get_option('default_post_edit_rows', 10), // rows="..."
            'tabindex' => '',
            'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the `<style>` tags, can use "scoped".
            'editor_class' => '', // add extra class(es) to the editor textarea
            'teeny' => false, // output the minimal editor config used in Press This
            'dfw' => false, // replace the default fullscreen with DFW (needs specific css)
            'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
            'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
        ),
        ) );

        $details_metabox->add_field( array(
        'name'    => 'Al doilea articol',
        'desc'    => 'Articol de tip blog (optional)',
        'id'      => 'second_article',
        'type'    => 'wysiwyg',
        'options' => array(
            'wpautop' => true, // use wpautop?
            'media_buttons' => true, // show insert/upload button(s)
            'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
            'textarea_rows' => get_option('default_post_edit_rows', 10), // rows="..."
            'tabindex' => '',
            'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the `<style>` tags, can use "scoped".
            'editor_class' => '', // add extra class(es) to the editor textarea
            'teeny' => false, // output the minimal editor config used in Press This
            'dfw' => false, // replace the default fullscreen with DFW (needs specific css)
            'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
            'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
        ),
        ) );

    }

    and this code to rearange the fields

    add_action( 'cmb2_init', 'evenimente_fields' );

    function evenimente_fields() {
        Inventor_Post_Types::add_metabox( 'eveniment', array(
            'general',
            'gallery',
            'banner',
            'contact',
            'social',
            'video',
            'location',
            'listing_category',
            'evenimente_articole',
        ) );
    }

    and we have the next error:

    Fatal error: Call to undefined method Inventor_Metaboxes::metabox_evenimente_articole() in
    /home/r45699zago/public_html/wp-content/plugins/inventor/includes/class-inventor-post-types.php on line 296

    we try with: listing_evenimente_articole,  listing_evenimet_evenimente_articole but we have the same error.

    Because the metabox is not added, I beliwe, the metabox is show on listing but the fields of this metabox are not saved.

    B. Change default avatar image

    We use this code (https://codex.wordpress.org/How_to_Use_Gravatars_in_WordPress):

    /* Custom Default Avatar Start */
    add_filter( 'avatar_defaults', 'new_default_avatar' );

    function new_default_avatar ( $avatar_defaults ) {
            //Set the URL where the image file for your avatar is located
            $new_avatar_url = get_stylesheet_directory_uri() . '/images/gravatar-zago.png';
            //Set the text that will appear to the right of your avatar in Settings>>Discussion
            $avatar_defaults[$new_avatar_url] = 'Zago Default Avatar';
            return $avatar_defaults;
    }
    /* Custom Default Avatar End */

    but the link of the image is:

    http://i2.wp.com/zago.ro/wp-content/themes/superlist-child/images/gravatar-zago.png

    instead of

    http://zago.ro/wp-content/themes/superlist-child/images/gravatar-zago.png

    Thank you in advance!