Hi,
I would like to buy the pro version but first I want to know if the plugin allows you to insert in a template “Recipe Data Structured” the ingredients one at a time like this:
<span itemprop=”ingredients”>400 grams of flour 00</span>
<span itemprop=”ingredients”>100 grams of ham</span>
…
?
Thank You.
Yes, you could use a repeater field to do something like that.
Are you asking if it will output the code that you included?
<span itemprop=”ingredients”>400 grams of flour 00</span>
<span itemprop=”ingredients”>100 grams of ham</span>
...
No, ACF does not automatically add content to your site. You will need to edit or create template files and code the output of the content yourself.
I know this… But the repetear function allow
<span itemprop=”ingredients”>ingredienti1</span>
<span=”ingredients”>ingredient2</span>
Or
<span=”ingredients”>ingredient1, ingredient2</span>
?
Thx
Yes, it would. Something like
if (have_rows('my_repeater_field')) {
while (have_rows('my_repeater_field')) {
the_row();
?>
<span="ingredients">
<?php the_sub_field('ingredient'); ?>
</span>
<?php
}
}
see http://www.advancedcustomfields.com/resources/have_rows/
Hi,
I bought the plugin but I find difficulty with the printing of ingredients (with repetear field) as you set?
The field is called “ingredients”, it works in the backend post, I put everything, but I can not make it appear in the template.
Can You Help Me?
Thank you.
Hi!
I’ll explain what I want to create: a list of ingredients.
I don’t know well the technicalities of the plugin but I would like to create something like this:
Field name ingredient: field quantities (eg 100 gr, 50 ml , 1, 2, 3, etc. etc.)
I would also like that the field name ingredient goes to read the ingredients url tag that I have in my db, with relative url, eg: Strawberries > url-of-mysite/strawberries.
If there is no tag can I put the ingredient without url.
An example:
Pasta with beans
ingredients:
beans/: 400 gr
pasta/: 350 gr
celery: 1 stalk
garlic: 1 clove
extra virgin olive oil: 3 tablespoons
oregano: to taste
salt and pepper: to taste
Thank you very much for your help.
You need to extend you code and relate it to WordPress tags or categories. I think for what you need is tags
1. Create a repeater field with two fields inside: ingredient_name and quantity. ingredient_name must be a taxonomy type field with post_tag.
2 in your template use ingredient_name to create the link; and ingredient_name + quantity to make the structured data
The topic ‘Structured Data Recipe (ingredients)’ is closed to new replies.
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.