Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wpscholar/wp-structured-video-data
Structured data for video embeds in WordPress.
https://github.com/wpscholar/wp-structured-video-data
wordpress wordpress-development wordpress-php-library
Last synced: about 1 month ago
JSON representation
Structured data for video embeds in WordPress.
- Host: GitHub
- URL: https://github.com/wpscholar/wp-structured-video-data
- Owner: wpscholar
- Created: 2019-05-28T15:41:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-28T15:42:18.000Z (over 5 years ago)
- Last Synced: 2024-10-01T16:17:11.990Z (about 2 months ago)
- Topics: wordpress, wordpress-development, wordpress-php-library
- Language: PHP
- Size: 1.95 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# WP Structured Video Data
Structured data for video embeds in WordPress.
Not familiar with structured data? Take a look at these resources:
- [Google Developers - Structured Video Data Reference](https://developers.google.com/search/docs/data-types/video)
- [Schema.org - VideoObject Reference](https://schema.org/VideoObject)
- [Google Structured Data Testing Tool](https://search.google.com/structured-data/testing-tool/u/0/)## Requirements
PHP 5.6+
WordPress 4.8+## Prerequisites
Install [Composer](https://getcomposer.org/)
## Installation
- Add the module to your WordPress plugin or theme project via Composer:
```bash
composer require wpscholar/wp-structured-video-data
```- Make sure you have added the Composer autoloader to your project:
```php
require __DIR__ . '/vendor/autoload.php';```
## Usage
By default, all video embeds in WordPress will automatically have the appropriate structured data injected.
## Advanced Usage
If you want to use this for specific video URLs that aren't within the WordPress content:
```php
render( $embed ); // For JSON-LD format// OR
echo $structuredData->renderAsMicrodata( $embed ); // For Microdata format
```Note that you will be responsible for also rendering the video embed. This can be done using [`wp_oembed_get()`](https://developer.wordpress.org/reference/functions/wp_oembed_get/).