Adding Additional Schema Types to Thesis 2

Thesis 2

Thesis 2 comes with a Schema API built in which has some common Schema types added by default, but did you know you can add your own additional Schema with a simple filter.

Thesis has the following common Schema types built in:

  • article
  • creativework
  • recipe
  • review

Adding additional schema requires two simple filters that can be added to your Boxes or Skins via box.php or skin.php.

protected function construct() {
    add_filter('thesis_schema_types', array( $this, 'add_schema_type'));
    add_filter('thesis_schema_options', array( $this, 'add_schema_option'));
}
public function add_schema_type($types) {
    $types['product'] = 'http://schema.org/Product';
    return $types;
}
public function add_schema_option($options) {
    $options['product'] = __('Product','thesis');
    return $options;
}

If you are adding this to custom.php then just simply add it like so.

add_filter('thesis_schema_types', 'add_schema_type');
function add_schema_type($types) {
    $types['product'] = 'http://schema.org/Product';
    return $types;
}
add_filter('thesis_schema_options', 'add_schema_option');
function add_schema_option($options) {
    $options['product'] = __('Product','thesis');
    return $options;
}

For more information about Schema types click here.

Thesis 2 is the most Advanced Template System on the WordPress Platform. One Framework, Infinite Possibilities. Check it out today!

Matthew Horne

Matthew is a web developer from the United Kingdom who taught himself PHP and JavaScript and never looked back. If you would like to hire me, shoot me an email.