本文整理汇总了PHP中add_theme_support函数的典型用法代码示例。如果您正苦于以下问题:PHP add_theme_support函数的具体用法?PHP add_theme_support怎么用?PHP add_theme_support使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_theme_support函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
add_theme_support('post-thumbnails');
$this->defaultPostThumb = $this->getTheme() . "/img/logo-circle.png";
// Remove stupid WP emoji support
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
// Add projects CPT
register_post_type('projects', array('labels' => array('menu_name' => 'Projects', 'name' => __('Project'), 'singular_name' => __('Project'), 'add_new' => __('Add'), 'add_new_item' => __('Add new project'), 'edit_item' => __('Edit project'), 'new_item' => __('New project'), 'all_items' => __('All projects'), 'view_item' => __('View project'), 'search_items' => __('Search projects'), 'not_found' => __('No projects found'), 'not_found_in_trash' => __('No projects found in trash')), 'public' => true, 'has_archive' => true, 'menu_position' => 9));
// Add votes metabox
function hackastory_votes_meta_box($post_type, $post)
{
add_post_meta($post->ID, 'project-votes-experimental', 0, true);
add_post_meta($post->ID, 'project-votes-potential', 0, true);
add_meta_box('votes_box', 'Votes', function ($post) {
echo 'Best experiment: ' . get_post_meta($post->ID, 'project-votes-experimental', true) . '<br>';
echo 'Most potential: ' . get_post_meta($post->ID, 'project-votes-potential', true);
}, array('projects'), 'side');
}
add_action('add_meta_boxes', 'hackastory_votes_meta_box', 10, 2);
// Define ajaxurl in frontend
function hackastory_ajaxurl()
{
?>
<script type="text/javascript">
var ajaxurl = '<?php
echo admin_url('admin-ajax.php');
?>
';
</script>
<?php
}
add_action('wp_head', 'hackastory_ajaxurl');
}
示例2: sparkling_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function sparkling_setup()
{
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
*/
load_theme_textdomain('sparkling', get_template_directory() . '/languages');
// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
/**
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support('post-thumbnails');
add_image_size('sparkling-featured', 750, 410, true);
add_image_size('tab-small', 60, 60, true);
// Small Thumbnail
// This theme uses wp_nav_menu() in one location.
register_nav_menus(array('primary' => esc_html__('Primary Menu', 'sparkling'), 'footer-links' => esc_html__('Footer Links', 'sparkling')));
// Enable support for Post Formats.
add_theme_support('post-formats', array('aside', 'image', 'video', 'quote', 'link'));
// Setup the WordPress core custom background feature.
add_theme_support('custom-background', apply_filters('sparkling_custom_background_args', array('default-color' => 'F2F2F2', 'default-image' => '')));
// Enable support for HTML5 markup.
add_theme_support('html5', array('comment-list', 'search-form', 'comment-form', 'gallery', 'caption'));
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support('title-tag');
}
示例3: setUp
public function setUp()
{
parent::setUp();
add_theme_support('infinite-scroll');
remove_action('init', 'the_neverending_home_page_init', 20);
$this->infinite_scroll = new The_Neverending_Home_Page();
}
示例4: omega_theme_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*/
function omega_theme_setup()
{
//remove_theme_mods();
/* Load omega functions */
require get_template_directory() . '/lib/functions/hooks.php';
add_theme_support('title-tag');
/* Load scripts. */
add_theme_support('omega-scripts', array('comment-reply'));
add_theme_support('post-thumbnails');
add_theme_support('omega-theme-settings');
add_theme_support('omega-content-archives');
/* implement editor styling, so as to make the editor content match the resulting post output in the theme. */
add_editor_style();
/* Support pagination instead of prev/next links. */
add_theme_support('loop-pagination');
/* Add default posts and comments RSS feed links to <head>. */
add_theme_support('automatic-feed-links');
/* Enable wraps */
add_theme_support('omega-wraps');
/* Enable custom post */
add_theme_support('omega-custom-post');
/* Enable custom css */
add_theme_support('omega-custom-css');
/* Enable custom logo */
add_theme_support('omega-custom-logo');
/* Enable child themes page */
add_theme_support('omega-child-page');
/* Handle content width for embeds and images. */
omega_set_content_width(700);
}
示例5: Destro_setup
function Destro_setup()
{
// This theme uses wp_nav_menu() in one location.
register_nav_menus(array('mainmenu' => __('Main Navigation', 'Destro')));
// This theme uses post thumbnails
add_theme_support('post-thumbnails');
add_image_size('Destrothumb', 450, 300, true);
// Add default posts and comments RSS feed links to head
add_theme_support('automatic-feed-links');
// Add translation support
load_theme_textdomain('Destro', get_template_directory() . '/languages');
// Delete default WordPress gallery css
add_filter('use_default_gallery_style', '__return_false');
// Add Custom background feature
if (of_get_option('skin_style')) {
$custombgargsskin = of_get_option('skin_style');
} else {
$custombgargsskin = 'destro';
}
if (get_stylesheet_directory() == get_template_directory()) {
$custombgargs = array('default-color' => '292929', 'default-image' => get_template_directory_uri() . '/images/' . $custombgargsskin . '/page_bg.png');
} else {
$custombgargs = array('default-image' => get_stylesheet_directory_uri() . '/images/page_bg.png');
}
add_theme_support('custom-background', $custombgargs);
}
示例6: setup
/**
* Theme setup
*/
function setup()
{
// Enable features from Soil when plugin is activated
// https://roots.io/plugins/soil/
add_theme_support('soil-clean-up');
add_theme_support('soil-nav-walker');
add_theme_support('soil-nice-search');
add_theme_support('soil-jquery-cdn');
add_theme_support('soil-relative-urls');
// Make theme available for translation
// Community translations can be found at https://github.com/roots/sage-translations
load_theme_textdomain('sage', get_template_directory() . '/lang');
// Enable plugins to manage the document title
// http://codex.wordpress.org/Function_Reference/add_theme_support#Title_Tag
add_theme_support('title-tag');
// Register wp_nav_menu() menus
// http://codex.wordpress.org/Function_Reference/register_nav_menus
register_nav_menus(['primary_navigation' => __('Primary Navigation', 'sage')]);
// Enable post thumbnails
// http://codex.wordpress.org/Post_Thumbnails
// http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size
// http://codex.wordpress.org/Function_Reference/add_image_size
add_theme_support('post-thumbnails');
// Enable post formats
// http://codex.wordpress.org/Post_Formats
add_theme_support('post-formats', ['aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio']);
// Enable HTML5 markup support
// http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']);
// Use main stylesheet for visual editor
// To add custom styles edit /assets/styles/layouts/_tinymce.scss
add_editor_style(Assets\asset_path('styles/main.css'));
}
示例7: aapcse_themesetup
function aapcse_themesetup()
{
// Setup the WordPress core custom background feature.
add_theme_support('custom-background', apply_filters('a11yall_custom_background_args', array('default-color' => 'eeeeee', 'default-image' => '')));
// Let users add "featured images", AKA post-thumbnails
add_theme_support('post-thumbnails');
}
示例8: setup
static function setup()
{
load_theme_textdomain('basics', get_template_directory() . '/lang');
add_theme_support('post-thumbnails');
add_theme_support('menus');
register_nav_menus(array('primary_navigation' => __('Primary Navigation', 'basics'), 'utility_navigation' => __('Utility Navigation', 'basics')));
}
示例9: eryn_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function eryn_setup()
{
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on eryn, use a find and replace
* to change 'eryn' to the name of your theme in all the template files
*/
load_theme_textdomain('eryn', get_template_directory() . '/languages');
// Feed Links
add_theme_support('automatic-feed-links');
// Post formats
add_theme_support('post-formats', array('aside', 'image', 'video', 'quote', 'link', 'gallery'));
// Post thumbnails
add_theme_support('post-thumbnails');
add_image_size('full-thumb', 940, 0, true);
add_image_size('slider-thumb', 650, 440, true);
add_image_size('thumb', 440, 294, true);
// This theme uses wp_nav_menu() in one location.
register_nav_menus(array('primary' => __('Primary Menu', 'eryn')));
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption'));
// Display Title in theme
add_theme_support('title-tag');
// Custom Backgrounds Support
$args = array('default-color' => 'FFFFFF');
add_theme_support('custom-background', $args);
// link a custom stylesheet file to the TinyMCE visual editor
$font_url = str_replace(',', '%2C', '//fonts.googleapis.com/css?family=Droid+Serif');
add_editor_style(array('style.css', 'css/editor-style.css', $font_url));
}
示例10: theme_setup
function theme_setup()
{
/* This theme uses post thumbnails (aka "featured images")
* all images will be cropped to thumbnail size (below), as well as
* a square size (also below). You can add more of your own crop
* sizes with add_image_size. */
add_theme_support('post-thumbnails');
set_post_thumbnail_size(120, 90, true);
add_image_size('square', 380, 380, true);
add_image_size('small-square', 185, 185, true);
add_image_size('half', 640, 640, true);
add_image_size('post', 600, 600, true);
add_image_size('about', 400, 566, true);
add_image_size('single-post', 600, 600, true);
// Add default posts and comments RSS feed links to head
add_theme_support('automatic-feed-links');
/* This theme uses wp_nav_menu() in one location.
* You can allow clients to create multiple menus by
* adding additional menus to the array. */
register_nav_menus(array('primary' => 'Primary Navigation'));
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption'));
}
示例11: SkeletonTube_Setup
/**
*
* THEME SETUP
*
**/
function SkeletonTube_Setup()
{
/**
*
* Navigation Menu
*
**/
register_nav_menus(array('primary' => __('Primary Menu'), 'footer' => __('Footer Menu')));
/**
*
* Add featured image support
*
**/
add_theme_support('post-thumbnails');
add_image_size('banner-image', 950, 350, true);
/**
*
* Search Form
*
**/
add_theme_support('html5', array('search-form'));
/**
*
* Add Post Format Support
*
**/
add_theme_support('post-formats', array('aside', 'gallery', 'link'));
}
示例12: et_setup_theme
function et_setup_theme()
{
global $themename, $shortname, $et_store_options_in_one_row, $default_colorscheme;
$themename = 'Divi';
$shortname = 'divi';
$et_store_options_in_one_row = true;
$default_colorscheme = "Default";
$template_directory = get_template_directory();
require_once $template_directory . '/epanel/custom_functions.php';
require_once $template_directory . '/includes/functions/comments.php';
require_once $template_directory . '/includes/functions/sidebars.php';
load_theme_textdomain('Divi', $template_directory . '/lang');
require_once $template_directory . '/epanel/core_functions.php';
require_once $template_directory . '/epanel/post_thumbnails_divi.php';
include $template_directory . '/includes/widgets.php';
register_nav_menus(array('primary-menu' => __('Primary Menu', 'Divi'), 'secondary-menu' => __('Secondary Menu', 'Divi'), 'footer-menu' => __('Footer Menu', 'Divi')));
// don't display the empty title bar if the widget title is not set
remove_filter('widget_title', 'et_widget_force_title');
add_action('wp_enqueue_scripts', 'et_add_responsive_shortcodes_css', 11);
add_theme_support('post-formats', array('video', 'audio', 'quote', 'gallery', 'link'));
add_theme_support('woocommerce');
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
add_action('woocommerce_before_main_content', 'et_divi_output_content_wrapper', 10);
remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_after_main_content', 'et_divi_output_content_wrapper_end', 10);
//remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
// deactivate page templates and custom import functions
remove_action('init', 'et_activate_features');
}
示例13: minileven_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*/
function minileven_setup()
{
global $wp_version;
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates
*/
require get_template_directory() . '/inc/tweaks.php';
/* Make Minileven available for translation.
* Translations can be added to the /languages/ directory.
* If you're building a theme based on Minileven, use a find and replace
* to change 'minileven' to the name of your theme in all the template files.
*/
load_theme_textdomain('minileven', TEMPLATEPATH . '/languages');
// Add default posts and comments RSS feed links to <head>.
add_theme_support('automatic-feed-links');
// This theme uses wp_nav_menu() in one location.
register_nav_menu('primary', __('Primary Menu', 'jetpack'));
// Add support for a variety of post formats
add_theme_support('post-formats', array('gallery'));
// Add support for custom backgrounds
if (version_compare($wp_version, '3.4', '>=')) {
add_theme_support('custom-background');
} else {
add_custom_background();
}
// Add support for post thumbnails
add_theme_support('post-thumbnails');
}
示例14: goran_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function goran_setup()
{
/*
* Declare textdomain for this child theme.
*/
load_child_theme_textdomain('goran', get_stylesheet_directory() . '/languages');
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_image_size('edin-thumbnail-landscape', 314, 228, true);
add_image_size('edin-thumbnail-square', 314, 314, true);
add_image_size('edin-featured-image', 772, 9999);
add_image_size('edin-hero', 1230, 1230);
/*
* Unregister nav menu.
*/
unregister_nav_menu('secondary');
/*
* Editor styles.
*/
add_editor_style(array('editor-style.css', goran_noto_sans_font_url(), goran_noto_serif_font_url(), goran_droid_sans_mono_font_url()));
/**
* Add support for Eventbrite.
* See: https://wordpress.org/plugins/eventbrite-api/
*/
add_theme_support('eventbrite');
}
示例15: actions_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function actions_setup()
{
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on actions, use a find and replace
* to change 'actions' to the name of your theme in all the template files.
*/
load_theme_textdomain('actions');
/**
* Add default posts and comments RSS feed links to head.
*/
add_theme_support('automatic-feed-links');
add_theme_support('customize-selective-refresh-widgets');
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support('post-thumbnails');
set_post_thumbnail_size(640, 300);
// This theme uses wp_nav_menu() in one locations.
register_nav_menus(array('primary' => esc_html__('Primary Menu', 'actions')));
/*
* Switch default core markup for search form, comment form, comments, galleries, captions and widgets
* to output valid HTML5.
*/
add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'widgets'));
/*
* Enable support for site logo.
*/
add_theme_support('custom-logo', array('height' => 150, 'width' => 250, 'flex-height' => true, 'header-text' => array('site-title', 'site-description')));
// Declare support for title theme feature
add_theme_support('title-tag');
}