{"id":90,"date":"2019-10-07T11:43:07","date_gmt":"2019-10-07T10:43:07","guid":{"rendered":"http:\/\/www.freelancewp.guide\/?p=90"},"modified":"2019-10-07T11:43:07","modified_gmt":"2019-10-07T10:43:07","slug":"change-default-image-size-on-visual-composer-single-image","status":"publish","type":"post","link":"https:\/\/freelancewp.guide\/change-default-image-size-on-visual-composer-single-image\/","title":{"rendered":"Change Default Image Size on Visual Composer Single Image"},"content":{"rendered":"\n

The Visual Composer Single Image component defaults the Image Size to \u2018thumbnail\u2019.  This really isn\u2019t very useful, especially if your clients are using Visual Composer to build pages.<\/p>\n\n\n\n

An Image Size of \u2018large\u2019, \u2018medium\u2019, or even a custom image size, is much more useful.<\/p>\n\n\n\n

If you\u2019ve set \u2018large\u2019 to be the same width as your main content area, the image will fit perfectly, and will also be great in smaller responsive areas.<\/p>\n\n\n\n

There\u2019s the code to re-map the Image Size default to \u2018large\u2019<\/p>\n\n\n\n

\/\/ Re-map VC Single Image params\nadd_action('init', function()\n{\n  \/\/ Get VC Single Image shortcode config\n  $single_img = WPBMap::getShortCode('vc_single_image');\n\n  \/\/ Loop over config to find the param we want to change\n  foreach($single_img['params'] as $key => $param)\n  {\n    \/\/ This is our param\n    if($param['param_name'] === 'img_size')\n    {\n    \/\/ Add standard value for image size\n    $single_img['params'][$key]['value'] = 'large';\n    }\n  }\n\n  \/\/ VC doesn't like the thought of you changing the shortcode base, and errors out, so we unset it.\n  unset($single_img['base']);\n\n  \/\/ Update the parameter\n  vc_map_update('vc_single_image', $single_img);\n}, 100);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

The Visual Composer Single Image component defaults the Image Size to \u2018thumbnail\u2019.  This really isn\u2019t very useful, especially if your clients are using Visual Composer to build pages. An Image Size of \u2018large\u2019, \u2018medium\u2019, or even a custom image size, is much more useful. If you\u2019ve set \u2018large\u2019 to be the same width as your main content […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/posts\/90"}],"collection":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/comments?post=90"}],"version-history":[{"count":0,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/posts\/90\/revisions"}],"wp:attachment":[{"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/media?parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/categories?post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freelancewp.guide\/wp-json\/wp\/v2\/tags?post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}