-
AuthorPosts
-
November 12, 2020 at 8:39 pm #1260211
Hi,
i would like to change the order of widgets on a product page on mobile devices. Now the order ist picture, widget and then the product description with price et. The widget should be at the bottom. Can you please help me?Thanks and best wishes,
MarkusNovember 17, 2020 at 6:16 am #1260902Hi Markus,
Sorry for the late reply. Please try this in your functions.php file:
function add_mobile_product_sidebar_below_description() { ?> <script> jQuery(document).ready(function($) { var sidebar = $('.single-product .smartphones_sidebar_active').detach(); $('.single-product .single-product-summary').append(sidebar); }); </script> <?php } add_action('wp_footer', 'add_mobile_product_sidebar_below_description');
Best regards,
RikardNovember 17, 2020 at 2:07 pm #1261002Hi Rikard,
thank you for your answer. The code you send me works, but now, the widget ist below the product description on mobile devices AND on the desktop pc.
My plan was, that the widget is only on mobiles below the description…do you have a solution for that?Best wishes,
MarkusNovember 18, 2020 at 11:53 am #1261238Hi Markus,
Thanks for the update. Please try this instead:
function add_mobile_product_sidebar_below_description() { if(wp_is_mobile()) { ?> <script> jQuery(document).ready(function($) { var sidebar = $('.single-product .smartphones_sidebar_active').detach(); $('.single-product .single-product-summary').append(sidebar); }); </script> <?php } } add_action('wp_footer', 'add_mobile_product_sidebar_below_description');
It should only apply on mobile devices.
Best regards,
RikardNovember 18, 2020 at 12:19 pm #1261245Hello,
thank you for the answer an the code. When i insert it in the functions.php file, i become this error: Deine PHP-Code-Änderungen wurden aufgrund eines Fehlers in Zeile 871 der Datei wp-content/themes/enfold/functions.php zurückgesetzt. Bitte beheben und versuchen, erneut zu speichern.
syntax error, unexpected ‘?’Can you help me?
Best wishes
markusNovember 19, 2020 at 6:15 am #1261458Hi,
I can’t reproduce that problem on my end, the code is added as it should. Where exactly are you adding it?
Best regards,
RikardNovember 19, 2020 at 11:03 am #1261495Hi Rikard,
thank you for your answer, today it works! i don’t know why, but it is ok…!Best wishes,
MarkusNovember 20, 2020 at 1:01 am #1261681Hi maraschommer,
Glad we could help :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.