How to create loop inside wordpress function?

How to create loop inside wordpress function?

error code: 523