Skip to content

Instantly share code, notes, and snippets.

Schema.Press schemapress

Block or report user

Report or block schemapress

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@schemapress
schemapress / schema_wp_set_default_image.php
Last active Sep 24, 2017
Filter to set default image for Schema plugin https://schema.press/
View schema_wp_set_default_image.php
<?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
@schemapress
schemapress / schema-wp-knowledge-graph-json-extend.php
Last active Sep 24, 2017
Extend Schema WordPress Plugin Knowledge Graph JSON-LD output https://schema.press/
View schema-wp-knowledge-graph-json-extend.php
<?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 ) {
View schema-wp-add-new-type.php
<?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 ) {
View schema-wp-extend-output.php
<?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-override-description-yoast-seo.php
Last active Oct 3, 2018
Override Schema description value with Yoast SEO description https://schema.press
View schema-wp-override-description-yoast-seo.php
<?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-override-media.php
Last active Sep 8, 2017
Override Schema media image with an attachment id from post meta https://schema.press
View schema-wp-override-media.php
<?php //* do not include php tag
add_filter( 'schema_wp_filter_media', 'schema_wp_override_media_with_image_attachment_id_post_meta_716235' );
/**
* Override media image with an attachment id from post meta
*
* @param array $media.
* @since 1.5
* @return array contains the image attributes
*/
View schema-wp-override-knowledge-graph.php
<?php //* do not include php tag
// First: we remove the Knowledge Graph markup
remove_filter( 'schema_wp_filter_output_knowledge_graph', 'schema_wp_do_output_knowledge_graph' );
// Second: we output the Knowledge Graph markup everywhere on the website
add_filter( 'schema_wp_filter_output_knowledge_graph', 'schema_wp_do_output_knowledge_graph_71837615376457563' );
/*
* Output Knowledge Graph markup, this function overrides Schema output
* so we can control where it should shown (not only the front page)
*
@schemapress
schemapress / schema-wp-override-description.php
Created Sep 13, 2017
Override Schema description value, use full content instead https://schema.press
View schema-wp-override-description.php
<?php //* do not include php tag
add_filter( 'schema_wp_filter_description', 'schema_wp_override_description_345675432567' );
/*
* Override Schema description value, use full content instead
*/
function schema_wp_override_description_345675432567( $schema_output ) {
global $post;
@schemapress
schemapress / schema-wp-shorten-headline.php
Created Sep 24, 2017
Shorten and Limit Headline by 110 characters for Schema plugin https://schema.press/
View schema-wp-shorten-headline.php
<?php //* do not include php tag
add_filter('schema_output', 'schema_wp_shorten_headline_output_98734524456');
/**
* Shorten / Limit Headline in Schema Output
*
* String length of headline must be in range [0, 110]
*
* @since 1.0
*/
@schemapress
schemapress / schema_wp_extend_output_articleBody.php
Created Sep 28, 2017
Add articleBody to Schema Output in Schema Plugin https://schema.press
View schema_wp_extend_output_articleBody.php
<?php //* do not include php tag
add_filter('schema_output', 'schema_wp_extend_output_articleBody_98738765');
/**
* Add articleBody to Schema Output
*
* @since 1.0
*/
function schema_wp_extend_output_articleBody_98738765( $schema ) {
You can’t perform that action at this time.