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 ) {
@schemapress
schemapress / schema-truncating-headlines.php
Created July 14, 2018 11:34
Truncating Headlines by characters count in Schema Plugin https://schema.press/docs/truncating-headlines/
<?php //* do not include php tag
add_filter('schema_wp_filter_headline', 'truncating_headlines_chars_567545256');
/**
* Schema Plugin: Truncating Headlines by characters count
*
* @since 1.0
*/
function truncating_headlines_chars_567545256( $headline ) {
@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-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-blog-output-remove.php
Created November 13, 2018 00:56
Remove Schema Plugin markup for Blog on home page https://schema.press/docs/remove-blog-markup/
<?php //* do not include php tag
add_filter( 'schema_blog_output', 'schema_blog_output_remove_8987716235' );
/**
* Remove Schema Plugin markup for Blog on home page
*
* @param array $schema
* @return array
*/
function schema_blog_output_remove_8987716235( $schema ) {
<?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 ) {
<?php //* do not include php tag
add_filter( 'schema_wp_author', 'schema_author_output_modify_8198771356' );
/**
* Modify The Author Schema Markup in Schema Plugin
*
* @param array $author
* @return array
*/
function schema_author_output_modify_8198771356( $author ) {
<?php //* do not include php tag
add_filter('schema_output', 'remove_datePublished_markup_588545256');
/**
* Schema Plugin: Remove datePublished markup on BlogPosting
*
* @since 1.0
*/
function remove_datePublished_markup_588545256( $schema ) {
<?php //* do not include php tag
add_filter('schema_wp_author', 'remove_author_url_markup_588877256');
/**
* Schema Plugin: Remove Author URL since it has the username id exposed.
*
* @since 1.0
*/
function remove_author_url_markup_588877256( $author ) {
@schemapress
schemapress / schema-premium-add-type.php
Last active January 26, 2019 01:08
Example: add support for new schema.org type in Schema Premium plugin https://schema.press/introducing-schema-premium/
<?php //* do not include php tag
/**
* @package Schema Premium - Class Schema New Type
* @category Core
* @author Hesham Zebida
* @version 1.0.0
*/
// Exit if accessed directly