Add image sizes

This commit is contained in:
Brian Miyaji
2014-01-12 02:49:50 +11:00
parent fd015f926b
commit 3fd8208902
4 changed files with 34 additions and 4 deletions

View File

@@ -0,0 +1 @@
<?php

View File

@@ -3,7 +3,7 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
global $post;
switch ( $column ):
case 'sp_logo':
edit_post_link( get_the_post_thumbnail( $post_id, 'sp_icon' ), '', '', $post_id );
edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-icon' ), '', '', $post_id );
break;
case 'sp_position':
echo get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—';

View File

@@ -1,6 +1,35 @@
<?php
function sportspress_plugins_loaded() {
load_plugin_textdomain ( 'sportspress', false, dirname( SPORTSPRESS_PLUGIN_BASENAME ) . '/languages/' );
add_image_size( 'sp_icon', 32, 32, false );
// Load plugin textdomain
if ( function_exists( 'load_plugin_textdomain' ) ) {
load_plugin_textdomain ( 'sportspress', false, dirname( SPORTSPRESS_PLUGIN_BASENAME ) . '/languages/' );
}
// Add image sizes
if ( function_exists( 'add_image_size' ) ) {
// Standard (4:3)
add_image_size( 'sportspress-standard', 800, 600, true );
add_image_size( 'sportspress-standard-thumbnail', 400, 300, true );
// Wide (16:9)
add_image_size( 'sportspress-wide', 640, 360, true );
add_image_size( 'sportspress-wide-thumbnail', 400, 225, true );
// Square (1:1)
add_image_size( 'sportspress-square', 612, 612, true );
add_image_size( 'sportspress-square-thumbnail', 200, 200, true );
// Header (1680 width minus 15 for scrollbar)
add_image_size( 'sportspress-header', 1665, 705, true );
// Icon (32px uncropped)
add_image_size( 'sportspress-icon', 32, 32, false );
}
}
add_action( 'plugins_loaded', 'sportspress_plugins_loaded' );

View File

@@ -97,7 +97,7 @@ require_once dirname( __FILE__ ) . '/admin/hooks/sanitize-title.php';
require_once dirname( __FILE__ ) . '/admin/hooks/the-content.php';
require_once dirname( __FILE__ ) . '/admin/hooks/wp-insert-post-data.php';
require_once dirname( __FILE__ ) . '/admin/hooks/plugin-action-links.php';
require_once dirname( __FILE__ ) . '/admin/hooks/image-size-names-choose.php';
// Register activation hook
require_once dirname( __FILE__ ) . '/admin/hooks/register-activation-hook.php';