[Support request] Schema and recipe

Home Forums Support [Support request] Schema and recipe

Home Forums Support Schema and recipe

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #1146184

    Hi Tom,

    I am trying to use the “Recipe” schema with GeneratePress without doing some hardcoding.

    I found the “generate_do_microdata” it does seem to work only with some predefined schema and I am not sure how to hook into it.

    Also, I want the title itemprop to be “name” instead of headLine? Is there a way?


    Customer Support

    Hi Leo,

    Yes it worked… Two others related question πŸ˜‰

    1) I would like to be able to filter that line that is in content-single.php

    			if ( generate_show_title() ) {
    				the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' );

    I want itemprop=”name”. At least in the case it is a recipe.

    2) Is there an internal variable or function that would return me the schema? So that I can know if it’s Recipe, CreativeWork, Video, etc… elsewhere in the code.

    Kind regards,

    Lead Developer
    Lead Developer

    Hi there,

    You would need to create a child theme and overwrite the entire file to change that, unfortunately.

    If it was me, I would opt to go with a JSON-LD solution instead of microdata.

    For example: https://wordpress.org/plugins/wpsso-schema-json-ld/

    Or more specific to recipes: https://wordpress.org/plugins/wp-recipe-maker/

    Then you can disable the theme microdata:

    add_filter( 'generate_schema_type', '__return_false' );

    Our microdata is filterable, but it’s somewhat complex to do with something like recipes – JSON-LD is a way better solution.

    Let me know if you need more info πŸ™‚


    Thanks Tom.

    I am not really a fan of the JSON solution for different reasons but I’ll just filter it out with the generate_show_title filter. I will post my solution for your user when I am done.

    One last question. I will need to also filter out the categories at the bottom of the article to add some itemprop in that. What is the tricks?

    Kindest regards,

    Lead Developer
    Lead Developer

    Absolutely – you can use this filter: generate_category_list_output

    add_filter( 'generate_category_list_output', function() {
        // Your solution here
    } );

    It worked Tom, thanks a lot.

    For those who wants to modify the itemprop of the title without having to overwrite the template file.

    add_filter('generate_show_title', function () {
        if (is_single() && in_the_loop() && is_main_query()) {
            the_title("<h1 class=\"entry-title\" itemprop=\"name\">", "</h1>");
            return false;
        } else {
            return true;

    Have a nice weekend!

    Lead Developer
    Lead Developer

    Ohh, cool solution! Thanks for sharing πŸ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.