Add image sizes
This commit is contained in:
1
admin/hooks/image-size-names-choose.php
Normal file
1
admin/hooks/image-size-names-choose.php
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?php
|
||||||
@@ -3,7 +3,7 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
|
|||||||
global $post;
|
global $post;
|
||||||
switch ( $column ):
|
switch ( $column ):
|
||||||
case 'sp_logo':
|
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;
|
break;
|
||||||
case 'sp_position':
|
case 'sp_position':
|
||||||
echo get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—';
|
echo get_the_terms ( $post_id, 'sp_position' ) ? the_terms( $post_id, 'sp_position' ) : '—';
|
||||||
|
|||||||
@@ -1,6 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
function sportspress_plugins_loaded() {
|
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' );
|
add_action( 'plugins_loaded', 'sportspress_plugins_loaded' );
|
||||||
|
|||||||
@@ -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/the-content.php';
|
||||||
require_once dirname( __FILE__ ) . '/admin/hooks/wp-insert-post-data.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/plugin-action-links.php';
|
||||||
|
require_once dirname( __FILE__ ) . '/admin/hooks/image-size-names-choose.php';
|
||||||
|
|
||||||
// Register activation hook
|
// Register activation hook
|
||||||
require_once dirname( __FILE__ ) . '/admin/hooks/register-activation-hook.php';
|
require_once dirname( __FILE__ ) . '/admin/hooks/register-activation-hook.php';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user