ACF Flexible Content

#212117
  • Resolved Kline Lozada
    Rank Math free

    Hello,

    I would like to ask if there’s an approach to the Flexible Content for ACF in RankMath?

    I’m using RankMath effectively, but this time, since I’m doing a recipe page, I need the HowToSteps and Ingredients to be dynamically inputted in the recipe page.

    So my question is if we have a different approach to do this on schema generator?

    I added a loom video on sensitive data. This is quite complicated, so I’m kind of confused on how we can approach this.

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • Brian
    Rank Math free

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Noticed that you have implemented the custom field variable in the schema generator as well. At the moment the custom field variable (%customfield%) will not work on the ACF fields. This is due to how ACF stores values in the post meta table.

    We have devised a way to which ACF fields can work with the schema generator as shown in our guide here: https://rankmath.com/kb/how-to-use-acf-fields-in-schema-generator/

    Please note that this might require extra knowledge on how to modify the filter to fit your suggested Recipe schema. I would recommend seeking guidance from a programmer if you are not sure of it as well.

    Hope this helps. Please let us know if you have any other questions.

    We really look forward to helping you.

    Thank you.

    Hello

    Thank you for the reply,

    I want to create this json_ld added on my schema, how can I do it with the code you provided? Since I was working on the recipe pages.

    
          "recipeIngredient": [
            "2 lbs. Top Sirloin, cut into 1” cubes",
            "3 Tbsp. Olive Oil or Avocado Oil",
            "1.5 Tbsp. Red Wine Vinegar",
            "Juice from ½ Lemon",
            "½ cup chopped Parsley",
            "¼ cup chopped Oregano",
            "8 cloves Garlic",
            "¾ tsp. Salt",
            "½ tsp. Black Pepper",
            "1 Red Bell Pepper, cut into chunks",
            "1 Yellow Bell Pepper, cut into chunks",
            "1 Red Onion, cut into chunks"
          ],

    Thanks

    Basically, I have an existing schema on my recipe pages now, but all I need to do, is to add this ingredients and then the HowToStep

    “recipeInstructions”: [
    {
    “@type”: “HowToStep”,
    “name”: “Combine”,
    “text”: “Step 1. In a bowl, combine 2 tablespoons of olive oil along with the red wine vinegar, lemon juice, parsley, oregano, garlic, salt and pepper”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Toss and marinate”,
    “text”: “Step 2. Toss the beef chunks in the mixture and marinate in the fridge for at least an hour.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Toss your chopped peppers”,
    “text”: “Step 3. Meanwhile, toss your chopped peppers and onion in the rest of the olive oil and a pinch of salt and pepper.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Thread the beef”,
    “text”: “Step 4. If you are using wooden skewers, soak them in water for 30 minutes prior to use. Thread the beef, onions and peppers on the skewers in whatever arrangement you’d like.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Preheat your grill”,
    “text”: “Step 5. Preheat your grill to medium heat.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Grill”,
    “text”: “Step 6. Place your kabobs on the grill and close the lid. Grill for around 10 minutes, turning a few times during cooking.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Check the internal temperature”,
    “text”: “Step 7. Use your Thermopro thermometer to check the internal temperature of the beef and cook to your desired doneness.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Serve”,
    “text”: “Step 8. Remove the beef from the grill and allow it to rest for a few minutes prior to serving. Top with chopped parsley and serve with your favorite side.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    }
    ]

    Brian
    Rank Math free

    Hello,

    Could we have a look at your ACF fields set up so we can know if it is possible to use this method with the schema generator?

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello, I would also like to raise a concern about a possible glitch, since you’re going to check the site, it would be great if you could also check what could be causing the glitch.

    I uploaded a loom video “Glitch with the calories rankmath schema” in the sensitive data field.

    Thanks

    Brian
    Rank Math free

    Hello,

    Thank you for getting back to us.

    Upon making further investigations, you have used the ACF repeater fields across your Ingredients and Instructions fields. We would recommend you to map these fields in a similar manner to the FAQ schema using this filter as:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	if( ! have_rows('acf-repeater-faq') ) {
    		return $data;
    	}
        $data['faqs'] = [
            '@type' => 'FAQPage',
        ];
        while( have_rows('acf-repeater-faq') ) {
    		the_row();
            $data['faqs']['mainEntity'][] = [
                '@type' => 'Question',
                'name'  => esc_attr( get_sub_field('faq_question') ),
                'acceptedAnswer' => [
                    '@type' => 'Answer',
                    'text'  => esc_attr( get_sub_field('faq_answer') ),
                ],
            ];
        }
        return $data;
    }, 10, 2 );

    You need to switch the main type to Recipe for the specific fields in this case the HowToStep and replace the subfields with your actual ACF subfields as instructions_name and instructions_description. Please see more here: https://rankmath.com/kb/how-to-use-acf-fields-in-schema-generator/

    If you are not sure how to go about it please consult a developer on this. At the moment such customizations fall outside the scope of our support.

    Hope this helps. Please let us know should you have any other questions.

    The account has a pro account you can check the license and everything in there.
    Also please if you could help me figure out a way to add the dynamic repeater information :

          "recipeIngredient": [
            "2 lbs. Top Sirloin, cut into 1” cubes",
            "3 Tbsp. Olive Oil or Avocado Oil",
            "1.5 Tbsp. Red Wine Vinegar",
            "Juice from ½ Lemon",
            "½ cup chopped Parsley",
            "¼ cup chopped Oregano",
            "8 cloves Garlic",
            "¾ tsp. Salt",
            "½ tsp. Black Pepper",
            "1 Red Bell Pepper, cut into chunks",
            "1 Yellow Bell Pepper, cut into chunks",
            "1 Red Onion, cut into chunks"
          ],

    and this

    “recipeInstructions”: [
    {
    “@type”: “HowToStep”,
    “name”: “Combine”,
    “text”: “Step 1. In a bowl, combine 2 tablespoons of olive oil along with the red wine vinegar, lemon juice, parsley, oregano, garlic, salt and pepper”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Toss and marinate”,
    “text”: “Step 2. Toss the beef chunks in the mixture and marinate in the fridge for at least an hour.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Toss your chopped peppers”,
    “text”: “Step 3. Meanwhile, toss your chopped peppers and onion in the rest of the olive oil and a pinch of salt and pepper.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Thread the beef”,
    “text”: “Step 4. If you are using wooden skewers, soak them in water for 30 minutes prior to use. Thread the beef, onions and peppers on the skewers in whatever arrangement you’d like.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Preheat your grill”,
    “text”: “Step 5. Preheat your grill to medium heat.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Grill”,
    “text”: “Step 6. Place your kabobs on the grill and close the lid. Grill for around 10 minutes, turning a few times during cooking.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Check the internal temperature”,
    “text”: “Step 7. Use your Thermopro thermometer to check the internal temperature of the beef and cook to your desired doneness.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    },
    {
    “@type”: “HowToStep”,
    “name”: “Serve”,
    “text”: “Step 8. Remove the beef from the grill and allow it to rest for a few minutes prior to serving. Top with chopped parsley and serve with your favorite side.”,
    “url”: “https://buythermopro.com/recipes/chimichurri-beef-kabobs/”
    }
    ]

    to extend my current recipe schema, that would be awesome.

    I added the format same as the example. Instead of adding or extend only the instruction, it made a ListItem and breaks the existing schema.

    {
          "@type": "Recipe",
          "itemListElement": [
            {
              "@type": "ListItem",
              "position": 1,
              "item": {
                "@type": "Recipe",
                "recipeInstructions": [
                  {
                    "@type": "HowToStep",
                    "name": "Preheat",
                    "text": "Step 1. Preheat the oven to 325 degrees Fahrenheit.",
                    "url": "https://buythermopro.com/recipes/classic-sunday-pot-roast-recipe/schema-preview",
                    "image": "https://buythermopro.com/wp-content/uploads/2021/05/classic-sunday-pot-roast-recipe.jpg"
                  },
                  {
                    "@type": "HowToStep",
                    "name": "Sprinkle",
                    "text": " Step 2. Sprinkle salt and pepper on your chuck roast on all sides. ",
                    "url": "https://buythermopro.com/recipes/classic-sunday-pot-roast-recipe/schema-preview",
                    "image": "https://buythermopro.com/wp-content/uploads/2021/05/classic-sunday-pot-roast-recipe.jpg"
                  },
                  {
                    "@type": "HowToStep",
                    "name": "Heat",
                    "text": "Step 3. Heat the avocado oil in a dutch oven on your stovetop over medium heat. Once the oil is hot, place the chuck roast in the pot. Let it sear for 3-4 minutes on each side. Remove the meat from the pot and set aside.",
                    "url": "https://buythermopro.com/recipes/classic-sunday-pot-roast-recipe/schema-preview",
                    "image": "https://buythermopro.com/wp-content/uploads/2021/05/classic-sunday-pot-roast-recipe.jpg"
                  },
                  {
                    "@type": "HowToStep",
                    "name": "Saute",
                    "text": "Step 4. Saute the onions in the dutch oven for a few minutes to pick up the browned bits on the bottom of the pot. Add the garlic and saute until fragrant",
                    "url": "https://buythermopro.com/recipes/classic-sunday-pot-roast-recipe/schema-preview",
                    "image": "https://buythermopro.com/wp-content/uploads/2021/05/classic-sunday-pot-roast-recipe.jpg"
                  },
                  {
                    "@type": "HowToStep",
                    "name": "Add ",
                    "text": "Step 5. Add half of the carrots and celery and stir for a minute. Add the thyme, rosemary, balsamic vinegar and tomato paste. Nestle the meat back into the pot and add the water or broth. ",
                    "url": "https://buythermopro.com/recipes/classic-sunday-pot-roast-recipe/schema-preview",
                    "image": "https://buythermopro.com/wp-content/uploads/2021/05/classic-sunday-pot-roast-recipe.jpg"
                  },
                  {
                    "@type": "HowToStep",
                    "name": "Set your ThermoPro",
                    "text": "Step 6. Set your ThermoPro thermometer to 205-210 degrees Fahrenheit and place the probe in the thickest part of the meat. Cover the pot and place in the oven for an hour.",
                    "url": "https://buythermopro.com/recipes/classic-sunday-pot-roast-recipe/schema-preview",
                    "image": "https://buythermopro.com/wp-content/uploads/2021/05/classic-sunday-pot-roast-recipe.jpg"
                  },
                  {
                    "@type": "HowToStep",
                    "name": "Remove the dutch oven from the oven",
                    "text": "Step 7. Remove the dutch oven from the oven and add the remaining carrots and celery along with the potatoes. Mix the uncooked veggies in with the veggies that are already in the pot, and flip the meat over. Add a sprig of rosemary or thyme to the pot. Reinsert the thermometer probe and cover the pot. ",
                    "url": "https://buythermopro.com/recipes/classic-sunday-pot-roast-recipe/schema-preview",
                    "image": "https://buythermopro.com/wp-content/uploads/2021/05/classic-sunday-pot-roast-recipe.jpg"
                  },
                  {
                    "@type": "HowToStep",
                    "name": "Place the dutch oven back in the oven",
                    "text": "Step 8. Place the dutch oven back in the oven for around 2 hours, until the thermometer has reached temperature or the pot roast is soft and tender. ",
                    "url": "https://buythermopro.com/recipes/classic-sunday-pot-roast-recipe/schema-preview",
                    "image": "https://buythermopro.com/wp-content/uploads/2021/05/classic-sunday-pot-roast-recipe.jpg"
                  },
                  {
                    "@type": "HowToStep",
                    "name": "Shred and Serve",
                    "text": " Step 9. Shred the pot roast and serve it alongside the veggies and some of the liquid in the pot.",
                    "url": "https://buythermopro.com/recipes/classic-sunday-pot-roast-recipe/schema-preview",
                    "image": "https://buythermopro.com/wp-content/uploads/2021/05/classic-sunday-pot-roast-recipe.jpg"
                  }
                ],
                "url": "https://buythermopro.com/recipes/classic-sunday-pot-roast-recipe/#recipe"
              }
            },
    Brian
    Rank Math free

    Hello,

    Thank you for getting back to us.

    Upon checking your schema we noticed that you have used the wrong type of schema. In real sense, you should have the instructions type defined as this way: https://i.rankmath.com/CEc4R4

    You do seem to have implemented the HowTo schema method and not the Recipe instructions set. We do not recommend this type of schema implementation on the Recipe content. Please make sure that you use the correct schema for your content type.

    When it comes to using the code with the ACF fields, you would need to target that with $data['recipe']['recipeInstructions'][].

    However just like in the FAQ schema, please make sure that you have already assigned the Recipe Schema to the $data['recipe] with something like '@type' => 'Recipe'.

    This should get you closer to the final code. Since we are not in a position to provide custom work you may have to consult a developer on this if you are not able to achieve the final code.

    Simply follow through with the example in the guide we had shared before.

    We hope this helps. Do let us know if you have any other queries.
    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 10 replies - 1 through 10 (of 10 total)

The ticket ‘ACF Flexible Content’ is closed to new replies.