How to Integrate RankMath FAQ schema with Bricks Dynamic FAQs using Metabox Custom Fields

Hi guys,
Do you know how to Integrate RankMath FAQ schema with Dynamic Bricks FAQs (in a template), which are being called with a shortcode into Blog Posts, using Metabox Custom Fields; Any help is appreaciated, TIA!

2 Likes

Did you ever get a solution to this Petya? I am using ACF but also find myself wanting to add areas for blogs and CPT that use say accordions or repeater fields where clients or our marketers can go in and add FAQ content there. I know Bricksultimate has a tut for this but I wondered what you’d unravelled. TIA :heart_eyes:

Hi

This is how I did it, without RankMath. You can do this yourself and you do not need a plugin…

I added a code element into my single template for my custom post type.

In the code element, I added this code, basically filling in all required information into the schema from acf and wordpress fields, in my case it is a recipe schema (see this for more information Schema.org - Schemas - Schema.org):

<?php
$schema = array();
$schema['recipeCategory'] = "";
$schema['@context'] = "https://schema.org";
$schema['@type']    = "Recipe";
$post = get_post();
$category_detail=get_the_category($post->ID);//Pass POST ID
foreach($category_detail as $cd){
$schema['recipeCategory'] .= $cd->cat_name.",";	
}	
$schema['name'] = wp_strip_all_tags( $post->post_title );
$schema['image']['@type'] = "ImageObject";
$schema['image'] ['url'] =get_the_post_thumbnail_url($post);
$schema['image'] ['width'] = "300";
$schema['image'] ['height'] = "246";
$schema['author']['@type'] = 'Person';
$schema['author']['name'] = get_field('name_autor');

etc. etc. etc.

when all schema elements are filled, I do this in the code element:

echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
?>

Done. Now google etc. finds the custom post type single template page and recognizes the schema.

Works very nicely with Bricks.

For a FAQ, you have to basically use this schema:

Check this out for more help on FAQ schema and the required PHP code:

Cheers

Patric

3 Likes