Skip to content

Instantly share code, notes, and snippets.

@ThemeSama
Last active December 19, 2017 17:28
Show Gist options
  • Select an option

  • Save ThemeSama/4437880295334bfa3367 to your computer and use it in GitHub Desktop.

Select an option

Save ThemeSama/4437880295334bfa3367 to your computer and use it in GitHub Desktop.
add_theme_support for WordPress
<?php
/**
* Theme Support, Nav & Textdomain
*
* @since 1.0
* @author ThemeSama (@theme_sama)
*/
if( !function_exists( 'THEMEPREFIX_theme_support' ) ) {
function THEMEPREFIX_theme_support() {
//Site Title Tag
add_theme_support( 'title-tag' );
//Post Formats
add_theme_support( 'post-formats', array(
'aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'
));
//Post Thumbnails
add_theme_support( 'post-thumbnails', array(
'post', 'page'
));
//Feed Links
add_theme_support( 'automatic-feed-links' );
//HTML5
add_theme_support( 'html5', array(
'comment-list', 'comment-form', 'search-form', 'gallery', 'caption'
));
//Optional Custom Background
//add_theme_support( 'custom-background', array() );
//Optional WooCommerce
//add_theme_support( 'woocommerce' );
//Register Nav Menus
register_nav_menus( array(
'main' => __('Main Menu', THEMETEXTDOMAIN ),
'mobile' => __('Mobile Menu', THEMETEXTDOMAIN )
));
//Load Theme Textdomain
load_theme_textdomain( THEMETEXTDOMAIN, THEMEPATH.'/languages' );
}
}
//hook
add_action( 'after_setup_theme', 'THEMEPREFIX_theme_support' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment