Tagged: Codeblock
-
AuthorPosts
-
February 12, 2017 at 7:29 am #745863
Hi,
Since the latest update, some code that I’m adding in a Code Block disappear after saving. I’m adding this Code Block on a Portfolio Item using the latest version of Enfold.
I’m loosing all the code that calls an external shopping cart using Javascript.
The code is perfectly working on all portfolio items created before the update. I only have the problem on new items or when I modify and update an existing portfolio page.
Thank you very much for your help!
February 13, 2017 at 7:40 am #746169Hey SteveRousseauDesigns,
Please send us a temporary admin login and login URL so that we can have a closer look. You can post the details in the Private Content section of your reply.
Best regards,
RikardFebruary 13, 2017 at 12:16 pm #746336Thank you for your quick reply!! I really appreciate your help. See details in private content.
February 14, 2017 at 10:59 am #746801Hi,
Thanks for the details, I had a look at the Portfolio item that we can use for testing. I’m guessing the code is supposed to be in the block under Rayane Rectangular Shawl? It looks to be empty unfortunately, what code are you trying to use there?
Best regards,
RikardFebruary 14, 2017 at 1:13 pm #746878Hi!
See in Private content.Thank you!
February 20, 2017 at 9:02 am #749211Hey!
Please create a new shortcode out of that script and use that shortcode instead of using the actual html.
// https://codex.wordpress.org/Function_Reference/add_shortcode
Add this in the functions.php file:
add_shortcode( 'rcartadd' , 'rcartaddfunc' ); function rcartaddfunc($atts) { $atts = shortcode_atts( array( 'first' => '45534', 'second' => '366794' ), $atts, 'rcartadd' ); $addtocart = __( 'Add to cart', 'avia_framework' ); $viewcart = __( 'View cart', 'avia_framework' ); $checkout = __( 'Checkout', 'avia_framework' ); return '<div class="avia-button-wrap avia-button-left"><a href="#" class="avia-button avia-icon_select-yes-left-icon avia-color-theme-color avia-size-small avia-position-left " onclick="R.cart.add('.$atts["first"].', '.$atts["second"].'); return false;"><span class="avia_button_icon avia_button_icon_left " aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello"></span><span class="avia_iconbox_title">'.$addtocart.'</span></a></div> <div style="padding:0 0 15px 0;"><a href="#" onclick="R.cart.show('.$atts["first"].'); return false;" style="text-decoration:underline;">'.$viewcart.' | '.$checkout.'</a></div>'; }
Add this shortcode in a code or text block:
[rcartadd first="1234" second="2345"]
Set the first and second parameter accordingly
Cheers!
IsmaelFebruary 20, 2017 at 1:38 pm #749322Hi Ismael,
Thank you very much for your answer! It’s working for the English version of the site.
How can I use this code to do the same thing on the French version of the site so that the button “Add to cart” and the link “View cart | Checkout” could show in French –> “Ajouter au panier” and “Voir le panier | Passer à l’achat”I tried to create a second shortcode in the functions.php file, but there’s probably something I’m doing wrong because it generates an error message when loading the site.
Your support is amazing!! Thank you so much!
February 21, 2017 at 5:33 am #749715Hi!
We updated the shortcode above. The text or strings should be translated automatically on another language as long as it is included in the language files. If you can’t see the translation, install the following plugin, go to its panel, search for the language and strings, translate then sync the language files.
// https://wordpress.org/plugins/loco-translate/
Cheers!
IsmaelFebruary 21, 2017 at 1:48 pm #749949Hi Ismael,
Thank you for your quick reply!
I have updated the shortcode as suggested and here is the result I get : http://steverousseaudesigns.com/wp-content/uploads/2017/02/Shortcode.jpg
Since the original shortcode you provided me is working perfectly on the English version, is it possible to create a second similar shortcode that would apply on the French version of the site? …
Again, thank you very much for your help!
Steve
February 22, 2017 at 7:07 am #750270Hey!
I’m sorry about that. We modified the code a bit. Please try it again.
If you want a different shortcode for the french language, use this:
add_shortcode( 'rcartaddfr' , 'rcartaddfrfunc' ); function rcartaddfrfunc($atts) { $atts = shortcode_atts( array( 'first' => '45534', 'second' => '366794' ), $atts, 'rcartaddfr' ); $addtocart = __( 'Ajouter au panier', 'avia_framework' ); $viewcart = __( 'Voir le panier', 'avia_framework' ); $checkout = __( 'Passer à l’achat', 'avia_framework' ); return '<div class="avia-button-wrap avia-button-left"><a href="#" class="avia-button avia-icon_select-yes-left-icon avia-color-theme-color avia-size-small avia-position-left " onclick="R.cart.add('.$atts["first"].', '.$atts["second"].'); return false;"><span class="avia_button_icon avia_button_icon_left " aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello"></span><span class="avia_iconbox_title">'.$addtocart.'</span></a></div> <div style="padding:0 0 15px 0;"><a href="#" onclick="R.cart.show('.$atts["first"].'); return false;" style="text-decoration:underline;">'.$viewcart.' | '.$checkout.'</a></div>'; }
The shortcode will look like this:
[rcartaddfr first="12345" second="67890"]
Best regards,
IsmaelFebruary 22, 2017 at 1:45 pm #750478Hi!
Amazing… it’s working. I’ve decided to use the different shortcode suggested for the French language.
I tried the other shortcode but the button was still showing in English. And I was afraid that their might be a problem to use the loco-translate plugin since I’m using the WPLM plugin. Maybe there’s a similar option in the WPML tools but I’m not familiar with it.
Your support team is the best!!
Thank you so much for your help!
Steve
February 24, 2017 at 4:03 am #751187Hi!
Great! Glad that we could help. If you have the time, please take a moment to review our theme and show your support https://themeforest.net/downloads
Thank you for using Enfold!
Cheers!
Ismael -
AuthorPosts
- The topic ‘Code Block – code disappear after saving’ is closed to new replies.