I was using your older plugin “Custom Content Shortcode” which in my opinion I thought was simpler. We had built several websites with this. Excellent work.
Now, with this plugin we have some questions but we will start with our first question
We have a group through ACF and some fields such as title, image, link etc
We have displayed these fields in an “options page” that we created.
I want to make a template for this, but to be able to understand this new version of the plugin, how could I do that?
Hello, thank you for the feedback. Welcome to Loops & Logic and the forum.
It’s true that CCS was a simpler plugin, easier to use with shortcodes. What happened was, I was creating more complex and bigger websites using CCS, and began to have difficulties due to the limitations of how shortcodes work, its syntax and parser (in WP core).
For example, the post content has many filters applied for automatic formatting, including the do_shortcode function; this causes unexpected changes to the resulting HTML. Another issue was that shortcodes aren’t really designed to be used in a “tree structure” like HTML templates. They can’t be nested, cannot pass values to each other, don’t work well in HTML attributes, and so on.
L&L was created to freshly imagine a template language that’s seamlessly integrated with HTML. It solves the issues I had with shortcodes, and made the templates more extensible and scalable. But I agree it’s not as simple to get started as with CCS. We’re trying to improve it with better documentation, examples, and articles.
At the bottom of the page is a short explanation of how to get fields from an options page. Assuming the options page was added with the acf_add_options_page function, you can access its fields by adding from=options to the Loop and Field tags.
Here is an example of getting child fields from an ACF group field.
<Loop acf_group=field_name from=options>
<Field title />
<Loop acf_image=image_field_name>
<a href="{Field url}"><Field title /></a>
</Loop>
</Loop>
I found the way for the image… nevertheless, it is quite complicated I would say although it is recognized from what I understand and at least I am happy about it.
I will continue with my work and if I need any further help, I will definitely go through here
Since you’re just starting the process of learning to write L&L markup, you might find this beginner’s guide useful in helping you get a good mental model of what L&L can do and understand why some of the markup you tried above does or doesn’t work on your site. Once you’ve got a good understanding of how it works, this post about L&L syntax and terminology might make it easier to read through the documentation and start writing your own markup. Hope those are helpful resources! If ever anything is unclear, please do reach out here or in the comments on those posts. I’d love to hear how those posts could be improved to help people like you get the most out of L&L.