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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.