Пример #1
0
 /**
  * Initial setup
  *
  * This function is attached to the 'after_setup_theme' action hook.
  *
  * @uses	load_theme_textdomain()
  * @uses	get_locale()
  * @uses	BAVOTASAN_THEME_TEMPLATE
  * @uses	add_theme_support()
  * @uses	add_editor_style()
  * @uses	add_custom_background()
  * @uses	add_custom_image_header()
  * @uses	register_default_headers()
  *
  * @since 1.0.0
  */
 function bavotasan_setup()
 {
     global $content_width;
     if (!isset($content_width)) {
         $content_width = absint(bavotasan_content_width());
     }
     load_theme_textdomain('national', BAVOTASAN_THEME_TEMPLATE . '/library/languages');
     // Add default posts and comments RSS feed links to <head>.
     add_theme_support('automatic-feed-links');
     // This theme styles the visual editor with editor-style.css to match the theme style.
     add_editor_style('library/css/admin/editor-style.css');
     // This theme uses wp_nav_menu() in two location.
     register_nav_menu('primary', __('Primary Menu', 'national'));
     // Add support for a variety of post formats
     add_theme_support('post-formats', array('gallery', 'image', 'video', 'audio', 'quote', 'link', 'status', 'aside'));
     // This theme uses Featured Images (also known as post thumbnails) for archive pages
     add_theme_support('post-thumbnails');
     add_image_size('grid', 360, 200, true);
     add_image_size('sticky', 320, 240, true);
     // Add a filter to bavotasan_header_image_width and bavotasan_header_image_height to change the width and height of your custom header.
     add_theme_support('custom-header', array('header-text' => false, 'flex-height' => true, 'flex-width' => true, 'random-default' => true, 'width' => apply_filters('bavotasan_header_image_width', 1200), 'height' => apply_filters('bavotasan_header_image_height', 550)));
     // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
     register_default_headers(array('header01' => array('url' => '%s/library/images/header01.jpg', 'thumbnail_url' => '%s/library/images/header01-thumbnail.jpg', 'description' => __('Default Header 1', 'national'))));
     // Add support for custom backgrounds
     add_theme_support('custom-background');
     // Add HTML5 elements
     add_theme_support('html5', array('comment-list', 'comment-form'));
     // Add title tag support
     add_theme_support('title-tag');
     // Infinite scroll
     add_theme_support('infinite-scroll', array('type' => 'scroll', 'container' => 'primary', 'wrapper' => false, 'footer' => false, 'footer_widgets' => 'extended-footer'));
     // Remove default gallery styles
     add_filter('use_default_gallery_style', '__return_false');
 }
Пример #2
0
// Functions for how to
require BAVOTASAN_THEME_TEMPLATE . '/library/preview-pro.php';
// Functions for upgrade
/**
 * Prepare the content width
 *
 * @since 1.0.3
 */
function bavotasan_content_width()
{
    $bavotasan_theme_options = bavotasan_theme_options();
    $bavotasan_array_content = array('col-md-2' => 0.1666, 'col-md-3' => 0.25, 'col-md-4' => 0.3333, 'col-md-5' => 0.4166, 'col-md-6' => 0.5, 'col-md-7' => 0.5833, 'col-md-8' => 0.6666, 'col-md-9' => 0.75, 'col-md-10' => 0.8333, 'col-md-12' => 1);
    return round($bavotasan_array_content[$bavotasan_theme_options['primary']] * $bavotasan_theme_options['width'] - 30);
}
if (!isset($content_width)) {
    $content_width = absint(bavotasan_content_width());
}
add_action('after_setup_theme', 'bavotasan_setup');
if (!function_exists('bavotasan_setup')) {
    /**
     * Initial setup
     *
     * This function is attached to the 'after_setup_theme' action hook.
     *
     * @uses	load_theme_textdomain()
     * @uses	get_locale()
     * @uses	BAVOTASAN_THEME_TEMPLATE
     * @uses	add_theme_support()
     * @uses	add_editor_style()
     * @uses	add_custom_background()
     * @uses	add_custom_image_header()
Пример #3
0
// Functions for update API
require BAVOTASAN_THEME_TEMPLATE . '/library/about.php';
// Functions for about page
/**
 * Prepare the content width
 *
 * @since 1.0.3
 */
function bavotasan_content_width()
{
    $bavotasan_theme_options = bavotasan_theme_options();
    $bavotasan_array_content = array('col-md-2' => 0.1666, 'col-md-3' => 0.25, 'col-md-4' => 0.3333, 'col-md-5' => 0.4166, 'col-md-6' => 0.5, 'col-md-7' => 0.5833, 'col-md-8' => 0.6666, 'col-md-9' => 0.75, 'col-md-10' => 0.8333, 'col-md-12' => 1);
    return round($bavotasan_array_content[$bavotasan_theme_options['primary']] * $bavotasan_theme_options['width'] - 30);
}
if (!isset($content_width)) {
    $content_width = bavotasan_content_width();
}
add_action('template_redirect', 'bavotasan_content_width_adjust');
/**
* Adjust content_width value for image attachment template.
*
@ since 1.0.3
*/
function bavotasan_content_width_adjust()
{
    if (is_bavotasan_full_width()) {
        $bavotasan_theme_options = bavotasan_theme_options();
        $GLOBALS['content_width'] = $bavotasan_theme_options['width'] - 30;
    }
}
add_action('after_setup_theme', 'bavotasan_setup');