Add image sizes in main class
This commit is contained in:
@@ -47,7 +47,7 @@ class SP_Install {
|
||||
*/
|
||||
public function install_actions() {
|
||||
// Install - Add pages button
|
||||
if ( ! empty( $_GET['install_sportspress_pages'] ) ) {
|
||||
if ( ! empty( $_GET['install_sportspress'] ) ) {
|
||||
|
||||
// We no longer need to install pages
|
||||
delete_option( '_sp_needs_pages' );
|
||||
@@ -58,7 +58,7 @@ class SP_Install {
|
||||
exit;
|
||||
|
||||
// Skip button
|
||||
} elseif ( ! empty( $_GET['skip_install_sportspress_pages'] ) ) {
|
||||
} elseif ( ! empty( $_GET['skip_install_sportspress'] ) ) {
|
||||
|
||||
// We no longer need to install pages
|
||||
delete_option( '_sp_needs_pages' );
|
||||
|
||||
@@ -12,39 +12,6 @@
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
function sportspress_plugins_loaded() {
|
||||
|
||||
// Load plugin textdomain
|
||||
if ( function_exists( 'load_plugin_textdomain' ) ) {
|
||||
load_plugin_textdomain ( 'sportspress', false, dirname( plugin_basename( SP_PLUGIN_FILE ) ) . '/languages/' );
|
||||
}
|
||||
|
||||
// Add image sizes
|
||||
if ( function_exists( 'add_image_size' ) ) {
|
||||
|
||||
// Standard (3:2)
|
||||
add_image_size( 'sportspress-standard', 637, 425, true );
|
||||
add_image_size( 'sportspress-standard-thumbnail', 303, 202, true );
|
||||
|
||||
// Wide (16:9)
|
||||
add_image_size( 'sportspress-wide-header', 1600, 900, true );
|
||||
add_image_size( 'sportspress-wide', 637, 358, true );
|
||||
add_image_size( 'sportspress-wide-thumbnail', 303, 170, true );
|
||||
|
||||
// Square (1:1)
|
||||
add_image_size( 'sportspress-square', 637, 637, true );
|
||||
add_image_size( 'sportspress-square-thumbnail', 303, 303, true );
|
||||
|
||||
// Fit (Proportional)
|
||||
add_image_size( 'sportspress-fit', 637, 637, false );
|
||||
add_image_size( 'sportspress-fit-thumbnail', 303, 303, false );
|
||||
add_image_size( 'sportspress-fit-icon', 32, 32, false );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'plugins_loaded', 'sportspress_plugins_loaded' );
|
||||
|
||||
function sportspress_default_venue_content( $query ) {
|
||||
if ( ! is_tax( 'sp_venue' ) )
|
||||
return;
|
||||
|
||||
@@ -145,39 +145,31 @@ final class SportsPress {
|
||||
* @return void
|
||||
*/
|
||||
public function autoload( $class ) {
|
||||
|
||||
$path = null;
|
||||
$class = strtolower( $class );
|
||||
$file = 'class-' . str_replace( '_', '-', $class ) . '.php';
|
||||
|
||||
if ( strpos( $class, 'sp_shortcode_' ) === 0 ) {
|
||||
|
||||
$path = $this->plugin_path() . '/includes/shortcodes/';
|
||||
$file = 'class-' . str_replace( '_', '-', $class ) . '.php';
|
||||
|
||||
if ( is_readable( $path . $file ) ) {
|
||||
include_once( $path . $file );
|
||||
return;
|
||||
}
|
||||
|
||||
} elseif ( strpos( $class, 'sp_meta_box_' ) === 0 ) {
|
||||
|
||||
} elseif ( strpos( $class, 'sp_meta_box' ) === 0 ) {
|
||||
$path = $this->plugin_path() . '/includes/admin/post-types/meta-boxes/';
|
||||
$file = 'class-' . str_replace( '_', '-', $class ) . '.php';
|
||||
|
||||
if ( is_readable( $path . $file ) ) {
|
||||
include_once( $path . $file );
|
||||
return;
|
||||
}
|
||||
} elseif ( strpos( $class, 'sp_admin' ) === 0 ) {
|
||||
$path = $this->plugin_path() . '/includes/admin/';
|
||||
}
|
||||
|
||||
if ( $path && is_readable( $path . $file ) ) {
|
||||
include_once( $path . $file );
|
||||
return;
|
||||
}
|
||||
|
||||
// Fallback
|
||||
if ( strpos( $class, 'sp_' ) === 0 ) {
|
||||
|
||||
$path = $this->plugin_path() . '/includes/';
|
||||
$file = 'class-' . str_replace( '_', '-', $class ) . '.php';
|
||||
}
|
||||
|
||||
if ( is_readable( $path . $file ) ) {
|
||||
include_once( $path . $file );
|
||||
return;
|
||||
}
|
||||
if ( $path && is_readable( $path . $file ) ) {
|
||||
include_once( $path . $file );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +200,7 @@ final class SportsPress {
|
||||
include_once( 'includes/admin/class-sp-admin.php' );
|
||||
}
|
||||
|
||||
if ( ! is_admin() ) {
|
||||
if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
|
||||
$this->frontend_includes();
|
||||
}
|
||||
|
||||
@@ -289,6 +281,24 @@ final class SportsPress {
|
||||
*/
|
||||
public function setup_environment() {
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
|
||||
// Standard (3:2)
|
||||
add_image_size( 'sportspress-standard', 637, 425, true );
|
||||
add_image_size( 'sportspress-standard-thumbnail', 303, 202, true );
|
||||
|
||||
// Wide (16:9)
|
||||
add_image_size( 'sportspress-wide-header', 1600, 900, true );
|
||||
add_image_size( 'sportspress-wide', 637, 358, true );
|
||||
add_image_size( 'sportspress-wide-thumbnail', 303, 170, true );
|
||||
|
||||
// Square (1:1)
|
||||
add_image_size( 'sportspress-square', 637, 637, true );
|
||||
add_image_size( 'sportspress-square-thumbnail', 303, 303, true );
|
||||
|
||||
// Fit (Proportional)
|
||||
add_image_size( 'sportspress-fit', 637, 637, false );
|
||||
add_image_size( 'sportspress-fit-thumbnail', 303, 303, false );
|
||||
add_image_size( 'sportspress-fit-icon', 32, 32, false );
|
||||
}
|
||||
|
||||
/** Helper functions ******************************************************/
|
||||
|
||||
Reference in New Issue
Block a user