Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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,
    Markus

    #1260902

    Hi 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,
    Rikard

    #1261002

    Hi 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,
    Markus

    #1261238

    Hi 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,
    Rikard

    #1261245

    Hello,
    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
    markus

    #1261458

    Hi,

    I can’t reproduce that problem on my end, the code is added as it should. Where exactly are you adding it?

    Best regards,
    Rikard

    #1261495

    Hi Rikard,
    thank you for your answer, today it works! i don’t know why, but it is ok…!

    Best wishes,
    Markus

    #1261681

    Hi maraschommer,

    Glad we could help :)

    If you need further assistance please let us know.
    Best regards,
    Victoria

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.