Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Typecase theme support declaration for WordPress themes.
<?php
/**
* Declares support for font families within your WordPress theme.
*
* By adding this code to your theme, it notifies the Typecase plugin
* that your theme allows for custom font locations that can be modified via
* the Customizer.
*/
add_theme_support( 'typecase', array(
// array of simple options
'simple' => array(
// each array is an option
// these options are displayed in the main theme fonts panel section
array(
// the label displayed in customizer
'label' => 'Body Copy',
// the CSS selector to apply the font to
'selector' => 'body',
// the default font for the selector
'default' => '"Noto Serif", serif',
),
array(
'label' => 'Headings (H1-H6)',
'selector' => 'h1, h2, h3, h4, h5, h6',
'default' => '"Noto Serif", serif',
),
array(
'label' => 'Article Title',
'selector' => 'h1.entry-title',
'default' => '"Noto Serif", serif',
),
),
// array of advanced options
// hidden by default, can be enabled by the user
'advanced' => array(
// each array is a customizer section in the theme fonts panel
'general' => array(
// each array is an option within the customizer section
array(
// the label displayed in customizer
'label' => 'Site Title',
// the CSS selector to apply the font to
'selector' => '.site-title',
// the default font for the selector
'default' => '"Noto Serif", serif',
),
array(
'label' => 'Site Description',
'selector' => '.site-description',
'default' => '"Noto Serif", serif',
),
),
'content' => array(
array(
'label' => 'Article Title',
'selector' => 'h1.entry-title',
'default' => '"Noto Serif", serif',
'description' => 'Large heading at the top of pages and posts',
),
array(
'label' => 'Block Quote',
'selector' => 'blockquote',
'default' => '"Noto Serif", serif',
),
array(
'label' => 'List Items (Bulleted and Numbered)',
'selector' => 'ul, ol',
'default' => '"Noto Serif", serif',
),
),
'sidebar' => array(
array(
'label' => 'Widget Content',
'selector' => '.widget',
'default' => '"Noto Serif", serif',
),
array(
'label' => 'Widget Titles',
'selector' => 'h2.widget-title',
'default' => '"Noto Serif", serif',
),
),
),
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment