Custom Fields
Re-Envisioned
Support MB Settings Page Image size in Oxygen

  • Creator
    Topic
  • #27648
    Resolved matthias@comflow.be
    Participant

    Hi Metabox team

    I'm struggling with the fields from my settings page to show them in the right dimensions:
    I'm using the code snippet below. However in the RWMB_meta the array with the size parameter is added later on, but doesn't do anything in specific. The thing is, when i return the value of that in a field, it automatically shows it square as the thumbnail, but i want it to keep it's orginal ratio. Can anyone help me improve my code? I'm using a single image as meta box custom field.

    /* Avoid Undefined Function Errors */
    if ( ! function_exists( 'rwmb_meta' ) ) {
        function rwmb_meta( $key, $args = '', $post_id = null ) {
            return false;
        }
    }
    /* Get the URL of logo image from the settings page */
    function wpdd_get_mb_settings_logo_url( $field_id ) {
        $logo = rwmb_meta( 'sitewide_logo', ['object_type' => 'setting'], 'general_settings', array( 'size' => 'Large' ) );
        
        return $logo ? $logo['url'] : 'https://morlinsgarage.be/wp-content/uploads/2021/04/logomorlins2_Tekengebied-1.png';
    }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.