Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View schemapress's full-sized avatar

Schema.Press schemapress

View GitHub Profile
@schemapress
schemapress / schema-wp-override-description-yoast-seo.php
Last active October 3, 2018 04:50
Override Schema description value with Yoast SEO description https://schema.press
<?php //* do not include php tag
add_filter( 'schema_output', 'schema_wp_override_description_yoast_seo_12345' );
/*
* Override Schema description value with Yoast SEO description
*/
function schema_wp_override_description_yoast_seo_12345( $schema_output ) {
// get description value from Yoast SEO post meta
$desc = get_post_meta( get_the_ID(), '_yoast_wpseo_metadesc', true);
@schemapress
schemapress / schema-wp-extend-output.php
Last active September 28, 2017 19:43
Extend / Override Schema.org JSON_LD Output https://schema.press/docs/extend-schema-output/
<?php //* do not include php tag
add_filter('schema_output', 'schema_wp_extend_output_987345256');
/**
* Extend / Override Schema Output
*
* @since 1.0
*/
function schema_wp_extend_output_987345256( $schema ) {
@schemapress
schemapress / schema-wp-add-new-type.php
Last active August 12, 2018 03:12
Extend Schema.org Types options of the WordPress Schema plugin https://schema.press/docs/adding-support-new-schema-org-types/
<?php //* do not include php tag
add_filter( 'schema_wp_types', 'schema_wp_new_add_schema_type_7623456' );
/**
* Add New type to Schema Types options
*
* @since 1.0
*/
function schema_wp_new_add_schema_type_7623456( $options ) {
@schemapress
schemapress / schema-wp-knowledge-graph-json-extend.php
Last active September 24, 2017 21:54
Extend Schema WordPress Plugin Knowledge Graph JSON-LD output https://schema.press/
<?php //* do not include php tag
add_action('schema_wp_knowledge_graph_json', 'schema_wp_knowledge_graph_json_123456');
/**
* Extend Schema Knowledge Graph JSON-LD output
*
* @return schema json-ld array
*/
function schema_wp_knowledge_graph_json_123456( $schema ) {
@schemapress
schemapress / schema_wp_set_default_image.php
Last active September 24, 2017 21:54
Filter to set default image for Schema plugin https://schema.press/
<?php //* do not include php tag
function schema_wp_set_default_image_12345( $json ) {
// If image is already defiend,
// return our $json array and do not do anything
if ( isset($json['media']) && ! empty($json['media']) ) return $json;
// There is no image defined in Schema array,
// set default ImageObject url, width, and height