Okay
  Public Ticket #3012993
Replace all Visual composer shortcodes [vc_single_image] with img src instead
Closed

Comments

  •  3
    Jonas started the conversation

    I'm in the middle of changing a Wordpress theme running on an old version of the WPBakery Visual Composer to the Salient Theme.

    After changing to the new theme and the new Salient WPBakery version, I'm getting a lot of broken shortcodes from the old WPBakery Visual Composer including [vc_single_image]

    Example: [vc_single_image image=”35182″ img_size=”full” alignment=”center”].

    Is there a way for me to replace all those broken shortcodes with the images that were once added to that shortcode?

  •  8,663
    Tahir replied

    Hey Jonas ,

    Here is a response from the Developer on a Similar Thread. 

    The Salient version of WPBakery has a different element set from the core WPbakery, so some elements that were added from the non-Salient version won't render when swapping. 

    Without simply switching back to the regular version of WPBakery, it's possible to register those core elements of WPBakery in the Salient version by using a filter from a child theme. Once you've activated the Salient child theme, add the following snippet into the functions.php:

    add_filter('salient_register_core_wpbakery_els','salient_child_core_wpbakery_els');
    function salient_child_core_wpbakery_els($arr) {
            $core_els = array('vc_single_image','vc_btn','vc_empty_space','vc_cta');
            return array_merge($arr, $core_els);
    }

    Thanks 


    ThemeNectar Support Team 

  •   Jonas replied privately
  •  1,039
    ThemeNectar replied

    Hey Jonassmile.png 
    You can map those buttons to Salient button elements by adding the following PHP snippet to your child theme functions.php file:

    add_shortcode('button','salient_convert_buttons');
    function salient_convert_buttons($attrs, $content = "") {
      $url = isset($attrs['url']) ? $attrs['url'] : '';
      $target = isset($attrs['target']) ? $attrs['target'] : '';
      
      return do_shortcode('[nectar_btn size="medium" button_style="regular" button_color_2="Accent-Color" open_new_tab="'.($target === '_blank' ? 'true' : 'false').'" url="'.$url.'" text="'.$content.'"]');
    }
    

    You will also need to deactivate the "Salient Shortcodes" plugin as to not interfere with the mapping to the WPBakery element.


    Kind regards,

  •   Jonas replied privately
  •  1
    ajumbra replied

    The first PHP snippet (for single image, empty space and cta) really helped. However, the button snippet did not work for us. Also, one of the bigger issues we have with moving from our old theme to Salient is that the row/column background colors and images are no longer displayed. Is there by any chance a PHP snippet to fix those? 

  •  1
    ajumbra replied

    Also - is there a way to map the padding/margin settings as well?

  •  1,782
    Judith replied

    Hello @ajumbra,

    Thanks for writing to us.

    To streamline our communication and ensure the timely resolution of all your inquiries, we kindly request that you open a new ticket for the new set of queries you have. This will allow us to prioritize and address each issue with the attention it deserves, without any potential oversight.

    We appreciate your cooperation and understanding in this matter.

    Best Regards.