This is not a coding forum. When you take on development of a custom theme, you are responsible for its results and performance. Instruction and guidance on Liquid coding is available elsewhere on the internet.
Even if this were an appropriate venue for coding help, you could not possibly expect help without showing the code involved.