Support

Account

Home Forums Backend Issues (wp-admin) Image field vs WYSIWYG or a better way? Reply To: Image field vs WYSIWYG or a better way?

  • Hi @Andrew C

    100% I would use an image field over the WYSIWYG field, simply for the fact that if your user selects the incorrect image size, then the website will break.

    The less a client can edit, the better your website will remain intact!

    Please refer to the image field documentation to see how you can load any size you wish for an image.

    The best option is to set the image field’s ‘return type’ to ‘image array’. This will give you an array containing all the image data including a ‘sizes’ array which holds all the different size urls and the width / height info.

    If PHP is not your strong point, I would set aside na hour to read over some basic array tutorials and play around with some debug code like so:

    
    <?php 
    
    $image = get_field('image_field');
    
    echo '<pre>';
    	print_r( $image );
    echo '</pre>';
    die;
    
     ?>
    

    As for the repeater field, yes, this is a much smarter way to organise your fields and will simplify your template code!

    Check out the have_rows function to loop through repeater field data!

    Hope that helps.

    Thanks
    E