Skip to content

Instantly share code, notes, and snippets.

View schemapress's full-sized avatar

Schema.Press schemapress

View GitHub Profile
<?php //* do not include php tag
add_filter('schema_wp_filter_headline', 'truncating_headlines_words_567545256');
/**
* Schema Plugin: Truncating Headlines by words count
*
* @since 1.0
*/
function truncating_headlines_words_567545256( $headline ) {
<?php //* do not include php tag
// Disable CollectionPage schema output on Categories
add_filter( 'schema_wp_output_category_enabled', '__return_false' );
// Disable CollectionPage schema output on Tags
add_filter( 'schema_wp_output_tag_enabled', '__return_false' );
<?php //* do not include php tag
add_filter( 'schema_output', 'schema_wp_override_description_yoast_seo_5636346455' );
add_filter( 'schema_about_page_output', 'schema_wp_override_description_yoast_seo_5636346455' );
add_filter( 'schema_contact_page_output', 'schema_wp_override_description_yoast_seo_5636346455' );
/*
* Pull Schema Title and Description values from Yoast SEO
*/
function schema_wp_override_description_yoast_seo_5636346455( $schema_output ) {
@schemapress
schemapress / schema_wp_markup_output_in_content.php
Created October 25, 2017 20:09
Add schema.org markup generated by Schema plugin to the content https://schema.press/
<?php //* do not include php tag
add_filter('the_content','my_schema_wp_markup_output_in_content_6876867');
/**
* Add schema.org markup generated by Schema plugin to the content
*
* return string
*/
function my_schema_wp_markup_output_in_content_6876867( $content ) {
<?php //* do not include php tag
/*
* A few ways to disable Schema plugin breadcrumbs json-ld output
*
* @since 1.6.9.5
*/
//------------------- (1)
//
@schemapress
schemapress / schema_wp_extend_output_articleBody.php
Created September 28, 2017 18:23
Add articleBody to Schema Output in Schema Plugin https://schema.press
<?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 ) {
@schemapress
schemapress / schema-wp-shorten-headline.php
Created September 24, 2017 21:56
Shorten and Limit Headline by 110 characters for Schema plugin https://schema.press/
<?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-override-description.php
Created September 13, 2017 18:26
Override Schema description value, use full content instead https://schema.press
<?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-override-knowledge-graph.php
Last active September 8, 2017 01:16
Override Knowledge Graph markup output https://schema.press
<?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-media.php
Last active September 8, 2017 01:14
Override Schema media image with an attachment id from post meta https://schema.press
<?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
*/