Description
Script that automates json-ld schema.org markup for wordpress websites.
By using PHP, and custom wordpress functions, the script reads the content of the page, and creates a json-ld script, which is added in the footer of each wordpress page.
The script creates separate json-ld for every page, populated with the provided information.
The json-ld will be added both on the existent, and on the new pages, and posts.
Implementation
- Create a Child Theme, and add the entire script in its functions.php file
- Upload the file via FTP
- Path: http://website.com/wp-content/themes/[Your-Theme]/inc/schema-markup.php
- Register: Add one of these lines to your theme’s functions.php file (follow the code structure):
- require_once( ‘inc/schema-markup.php’ );
- require_once get_template_directory() . ‘/inc/schema_markup.php’;
- Install a Custom Code Plugin, and create a php snippet to add the script
You can check the script online on Github!