Home › Forums › Add-ons › Repeater Field › ACF and CSS Grid? › Reply To: ACF and CSS Grid?
“It doesn’t work” could mean anything. It’s clear that something doesn’t work because otherwise you wouldn’t be posting here. But please be more specific as to what exactly isn’t working. What is the output of the code? Is it not printing the values at all? Or perhaps it’s not even the PHP but an error in the CSS? Look at the output source code and see if it prints anything for the_sub_field('column_start');
etc. If that’s all working then the error is in the CSS itself.
I’m going to look over the fact that CSS should at least go into the header of the HTML document, not in the body, but definitely you need to address each image in the repeater individually (as in your second example) because otherwise the last value that is printed will style all images. But you can actually get the current row index inside a has_rows()
loop with get_row_index()
; no need for the incementing counter variable.
Now, I’m not too experienced with CSS grid yet, as I’ve mostly avoided it for reasons of browser support, but I’m skeptical about the row and column placement properties in combination with auto-fill columns and a fixed number of rows. If the user specifies to place the image in column 100 and row 10, how is that going to work with the specification of the grid template rows and columns? I think therein lies the actual problem; it’s not an ACF repeater issue.
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!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?
— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.