当前位置: 首页>>代码示例>>PHP>>正文


PHP add_image_size函数代码示例

本文整理汇总了PHP中add_image_size函数的典型用法代码示例。如果您正苦于以下问题:PHP add_image_size函数的具体用法?PHP add_image_size怎么用?PHP add_image_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了add_image_size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: risto_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 for post thumbnails.
  */
 function risto_theme_setup()
 {
     // Add default posts and comments RSS feed links to head.
     add_theme_support('automatic-feed-links');
     /*
      * 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');
     /*
      * Enable support for Post Thumbnails on posts and pages.
      *
      */
     add_theme_support('post-thumbnails');
     add_image_size('services', 200, 118, true);
     // This theme uses wp_nav_menu() in one location.
     register_nav_menus(array('primary' => __('Primary Menu', 'risto-theme'), 'secondary' => __('Secondary Menu', 'risto-theme')));
     /*
      * 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'));
     /*
      * Enable support for Post Formats.
      * See http://codex.wordpress.org/Post_Formats
      */
     add_theme_support('post-formats', array('aside', 'image', 'video', 'quote', 'link'));
 }
开发者ID:risto987,项目名称:wordpress-portfolio-theme,代码行数:37,代码来源:functions.php

示例2: maybe_add_image_size

 /**
  * Action on the after_setup_theme hook.
  * Checks to see if the author_pro_archive image size exists
  * then adds author_pro_archive image size if it isn't set.
  * This allows the child theme or another plugin to override the image size.
  *
  * @access public
  * @static
  * @return void
  */
 static function maybe_add_image_size()
 {
     global $_wp_additional_image_sizes;
     if (!isset($_wp_additional_image_sizes['author-pro-image'])) {
         add_image_size('author-pro-image', 360, 570, TRUE);
     }
 }
开发者ID:FrankM1,项目名称:Genesis-Author-Pro,代码行数:17,代码来源:class.Genesis_Author_Pro_CPT.php

示例3: pitch_slide_init

/**
 * Initialize Pitch's slide post type
 */
function pitch_slide_init()
{
    $labels = array('name' => _x('Slides', 'post type general name', 'pitch'), 'singular_name' => _x('Slide', 'post type singular name', 'pitch'), 'add_new' => _x('Add New', 'book', 'pitch'), 'add_new_item' => __('Add New Slide', 'pitch'), 'edit_item' => __('Edit Slide', 'pitch'), 'new_item' => __('New Slide', 'pitch'), 'all_items' => __('All Slide', 'pitch'), 'view_item' => __('View Slide', 'pitch'), 'search_items' => __('Search Slides', 'pitch'), 'not_found' => __('No slides found', 'pitch'), 'not_found_in_trash' => __('No slides found in Trash', 'pitch'), 'parent_item_colon' => '', 'menu_name' => __('Slides', 'pitch'));
    $args = array('labels' => $labels, 'public' => false, 'publicly_queryable' => false, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => false, 'rewrite' => false, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => null, 'supports' => array('title', 'thumbnail', 'excerpt', 'page-attributes'), 'menu_icon' => get_template_directory_uri() . '/images/post-types/slider-small.png');
    register_post_type('slide', $args);
    add_image_size('slide', 960, siteorigin_setting('slider_height'), true);
}
开发者ID:Ksajikyan,项目名称:poiskuslug.ru,代码行数:10,代码来源:slide.php

示例4: foundation_featured_setup

function foundation_featured_setup()
{
    if (function_exists('add_theme_support')) {
        add_theme_support('post-thumbnails');
        add_image_size('foundation-featured-image', 900, 9999, false);
    }
    global $foundation_featured_posts;
    $settings = foundation_get_settings();
    $args = foundation_featured_get_args();
    if ($settings->featured_enabled) {
        $slides = foundation_featured_get_slides();
        $slide_count = 0;
        if ($slides->post_count > 0) {
            while ($slides->have_posts() && $slide_count < $args['num']) {
                $slides->the_post();
                $image = foundation_featured_has_image();
                if ($image) {
                    $slide_count++;
                    $foundation_featured_posts[] = get_the_ID();
                }
            }
        }
    }
    add_filter('parse_query', 'foundation_featured_modify_query');
}
开发者ID:ahua,项目名称:www,代码行数:25,代码来源:featured.php

示例5: 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()
  * @uses	register_default_headers()
  *
  * @since 1.0.0
  */
 function bavotasan_setup()
 {
     load_theme_textdomain('arcade', 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', 'arcade'));
     // 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('half', 570, 220, true);
     add_image_size('square100', 100, 100, 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', 1800), 'height' => apply_filters('bavotasan_header_image_height', 1200)));
     // 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', 'arcade'))));
     // 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');
     // Remove default gallery styles
     add_filter('use_default_gallery_style', '__return_false');
     // Infinite scroll
     add_theme_support('infinite-scroll', array('type' => 'scroll', 'container' => 'primary', 'wrapper' => false, 'footer' => false));
     // Add Woocommerce support
     add_theme_support('woocommerce');
 }
开发者ID:jeremygeltman,项目名称:ThinkThinly,代码行数:48,代码来源:functions.php

示例6: 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'));
 }
开发者ID:evanolivia,项目名称:custom-wordpress-theme,代码行数:26,代码来源:functions.php

示例7: 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));
 }
开发者ID:COfrost,项目名称:www.example.dev,代码行数:41,代码来源:functions.php

示例8: nimbus_setup

 function nimbus_setup()
 {
     // Localization
     $lang_local = get_template_directory() . '/lang';
     load_theme_textdomain('nimbus', $lang_local);
     // Register Thumbnail Sizes
     add_theme_support('post-thumbnails');
     set_post_thumbnail_size(1160, 9999, true);
     add_image_size('nimbus-small', 140, 90, true);
     add_image_size('nimbus-feature', 370, 191, true);
     add_image_size('nimbus-post', 760, 227, true);
     add_image_size('nimbus-post-full', 1160, 221, true);
     add_image_size('full-banner', 1160, 360, true);
     add_image_size('half-banner', 660, 360, true);
     add_image_size('half-image', 670, 424, true);
     add_image_size('full-image', 1170, 424, true);
     // Load feed links
     add_theme_support('automatic-feed-links');
     // Support Custom Background
     $nimbus_custom_background_defaults = array('default-color' => 'ffffff');
     add_theme_support('custom-background', $nimbus_custom_background_defaults);
     // Set Content Width
     global $content_width;
     if (!isset($content_width)) {
         $content_width = 770;
     }
     // Register Menus
     register_nav_menu('primary', __('Primary Menu', 'nimbus'));
     register_nav_menu('mobile', __('Mobile Menu', 'nimbus'));
 }
开发者ID:CoderDojo-Guadalajara,项目名称:coderdojo-guadalajara,代码行数:30,代码来源:functions.php

示例9: saga_register_image_sizes

/**
 * Registers custom image sizes for the theme.
 *
 * @since  1.0.0
 * @access public
 * @return void
 */
function saga_register_image_sizes()
{
    /* Sets the 'post-thumbnail' size. */
    set_post_thumbnail_size(175, 119, true);
    /* Adds the 'saga-large' image size. */
    add_image_size('saga-large', 1100, 9999, false);
}
开发者ID:starise,项目名称:saga,代码行数:14,代码来源:theme.php

示例10: untitled_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.
  *
  * @since untitled 1.0
  */
 function untitled_setup()
 {
     /**
      * Make theme available for translation
      * Translations can be filed in the /languages/ directory
      * If you're building a theme based on untitled, use a find and replace
      * to change 'untitled' to the name of your theme in all the template files
      */
     load_theme_textdomain('untitled', 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
      */
     add_theme_support('post-thumbnails', array('post', 'page'));
     set_post_thumbnail_size(150, 150);
     add_image_size('slider-img', 1440, 400, true);
     add_image_size('content-img', 300, 168, true);
     add_image_size('thumbnail-img', 62, 62, true);
     add_image_size('feat-img', 1000);
     /**
      * This theme uses wp_nav_menu() in one location.
      */
     register_nav_menus(array('primary' => __('Primary Menu', 'untitled')));
     /**
      * Enable support for Post Formats
      */
     add_theme_support('post-formats', array('aside', 'image', 'video', 'quote', 'link'));
 }
开发者ID:chrisnicosia88,项目名称:my-first-site,代码行数:40,代码来源:functions.php

示例11: singolo_images_size

function singolo_images_size()
{
    add_image_size('slider', 1020, 600, true);
    add_image_size('project-thumb', 200, 190, true);
    add_image_size('medium', 300, 300, true);
    add_image_size('services', 60, 60, true);
}
开发者ID:botezalexandru,项目名称:Singolo_Wordpress,代码行数:7,代码来源:functions.php

示例12: sensible_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 sensible_setup()
 {
     // Add default posts and comments RSS feed links to head.
     add_theme_support('automatic-feed-links');
     /*
      * 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');
     /*
      * 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('home-blog', 400, 250, true);
     // This theme uses wp_nav_menu() in one location.
     register_nav_menus(array('primary' => __('Primary Menu', 'sensible'), 'mobile' => esc_html__('Mobile', 'sensible')));
     /*
      * 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'));
     // Set up the WordPress core custom background feature.
     add_theme_support('custom-background', apply_filters('sensible_custom_background_args', array('default-color' => 'ffffff', 'default-image' => '')));
 }
开发者ID:brianotoole,项目名称:tbttt,代码行数:35,代码来源:functions.php

示例13: my_setup

 function my_setup()
 {
     // This theme styles the visual editor with editor-style.css to match the theme style.
     add_editor_style();
     // This theme uses post thumbnails
     if (function_exists('add_theme_support')) {
         // Added in 2.9
         add_theme_support('post-thumbnails');
         set_post_thumbnail_size(235, 148, true);
         // Normal post thumbnails
         add_image_size('post-thumbnail-xl', 578, 250, true);
         // Portfolio Extra Large Thumbnail
         add_image_size('portfolio-post-thumbnail', 268, 168, true);
         // Portfolio Thumbnail
         add_image_size('portfolio-post-thumbnail-small', 196, 148, true);
         // Portfolio Small Thumbnail
         add_image_size('portfolio-post-thumbnail-large', 417, 208, true);
         // Portfolio Large Thumbnail
         add_image_size('portfolio-post-thumbnail-xl', 498, 238, true);
         // Portfolio Extra Large Thumbnail
         add_image_size('small-post-thumbnail', 139, 139, true);
         // Small Thumbnail
     }
     // Add default posts and comments RSS feed links to head
     add_theme_support('automatic-feed-links');
     // custom menu support
     add_theme_support('menus');
     if (function_exists('register_nav_menus')) {
         register_nav_menus(array('header_menu' => 'Header Menu'));
     }
 }
开发者ID:anaved,项目名称:wordpress-tinkering,代码行数:31,代码来源:theme-init.php

示例14: setup

/**
 * Theme setup
 */
function setup()
{
    // Make theme available for translation
    load_theme_textdomain('boilerplate', get_template_directory() . '/assets/languages');
    // 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(['nav-primary' => _x('Primary Navigation', 'primary site nav menu', 'boilerplate'), 'nav-footer' => _x('Footer Navigation', 'footer site nav menu', 'boilerplate')]);
    // Add 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');
    add_image_size('boilerplate-vignette', 300, 250, true);
    // Add post formats
    // http://codex.wordpress.org/Post_Formats
    # add_theme_support('post-formats', ['aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio']);
    // Add HTML5 markup for captions
    // http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5
    add_theme_support('html5', ['caption', 'comment-form', 'comment-list']);
    // Tell the TinyMCE editor to use a custom stylesheet
    # add_editor_style( 'assets/styles/dist/editor.css' );
}
开发者ID:locomotivemtl,项目名称:wordpress-boilerplate,代码行数:28,代码来源:init.php

示例15: portfilo_portfolio_theme_setup

 function portfilo_portfolio_theme_setup()
 {
     add_theme_support('title-tag');
     add_theme_support('custom-background');
     $args = array('flex-width' => true, 'width' => 1400, 'flex-height' => true, 'height' => 600, 'default-image' => get_template_directory_uri() . '/images/overlay.jpg');
     add_theme_support('custom-header', $args);
     /* ---------------------------------------------------------------------------
      * Loads Theme Textdomain
      * --------------------------------------------------------------------------- */
     load_theme_textdomain('portfilo', PORTFILO_LANG_DIR);
     add_theme_support('automatic-feed-links');
     add_theme_support('woocommerce');
     add_theme_support('post-thumbnails');
     set_post_thumbnail_size(260, 146, false);
     // admin - featured image
     add_image_size('portfilo_50x50', 50, 50, false);
     // admin - lists
     add_image_size('portfilo-aboutus-thumbnail', 1140, 640, true);
     add_image_size('portfilo-blog-listing-thumbnail', 458, 244, true);
     add_image_size('portfilo-blog-detail-thumbnail', 750, 400, true);
     add_image_size('portfilo-slider-thumbnail', 1400, 786, true);
     /* ---------------------------------------------------------------------------
      * Registers a menu location to use with navigation menus.
      * --------------------------------------------------------------------------- */
     /*register_nav_menu('primary', __('Main menu', 'portfilo'));
       register_nav_menu('footer', __('Footer menu', 'portfilo'));*/
     register_nav_menus(array('primary' => __('Primary Navigation', 'portfilo'), 'secondary' => __('Secondary Navigation', 'portfilo')));
     add_action('add_meta_boxes', 'portfilo_Slider');
     add_action('save_post', 'PortfiloSaveHomePageSlider');
 }
开发者ID:lillian7,项目名称:wordpress,代码行数:30,代码来源:theme-functions.php


注:本文中的add_image_size函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。