• Resolved Jlwp

    (@jlwp123)


    I think this is a fantastic plugin, yesterday I left a five star review :
    One of the reasons I think this is a fantastic plugin is that it allows programmatic adding of schema as described at:
    https://docs.wpslimseo.com/slim-seo/schema/
    This gives the example code:

    add_filter( 'slim_seo_schema_graph', function ( $graph ) {
    if ( is_singular( 'movie' ) ) {
    $graph[] = [
    '@type' => 'Movie',
    'name' => get_the_title(),
    'director' => get_post_meta( get_the_ID(), 'director', true ),
    ];
    }
    return $graph;
    } );

    And this works really well.

    But I would like to add eg:

    {
    "@context": "https://schema.org",
    "@type": "WebPage",
    "name": "Mortgage Calculator",
    "mainEntity": {
    "@type": "SoftwareApplication",
    "name": "Mortgage Calculator",
    "operatingSystem": "Web",
    "applicationCategory": "Calculator",
    "isAccessibleForFree": true
    }
    }

    Where “”@type”: “SoftwareApplication”, is a sub or nested property of “mainEntity”.

    Is is possible to add this type of schema structure in the free version?

    Thanks ahead of time and thanks for such a great plugin.

    • This topic was modified 1 month ago by Jlwp.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi @jlwp123 ,

    Yes, you can add complex, nested properties for schemas by using the similar code. But instead of just adding a flat array, you can add a multi-dimensional array, like this (untested):

    add_filter( 'slim_seo_schema_graph', function ( $graph ) {
    $graph[] = [
    "@type" => "WebPage",
    "name" => "Mortgage Calculator",
    "mainEntity" => [
    "@type" => "SoftwareApplication",
    "name" => "Mortgage Calculator",
    "operatingSystem" => "Web",
    "applicationCategory" => "Calculator",
    "isAccessibleForFree" => true,
    ],
    ];
    return $graph;
    } );

    However, we’d recommend Slim SEO Pro for a visual schema builder, where you see and enter the details much easier. After adding schemas, you can use our browser extension to check if they’re valid.

    Thread Starter Jlwp

    (@jlwp123)

    Hello @rilwis thank you for your response. I am just starting this site and will definitely buy Pro when the site starts to generate some money.

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

You must be logged in to reply to this topic.