私の theme-functions.php ファイルには、
add_image_size('ad-medium', $width = 250, $height = 250, true );
これにより、Wordpress が「広告媒体」のサムネイルを作成するサイズが決まります。このコードを変更すると、ウェブサイトに表示される内容が即座に決定されます。
したがって、250 を 100 に変更すると、幅が 100px に縮小されます。残念ながら、これには 3 つの問題があります。
- これにより、ad-medium の今後のすべてのアップロード サイズ変更のサイズが変更されるため、それは問題外です。
- 高さは無視されます - ワープできません - 何があっても 1:1 のアスペクト比のままです。
- 100%書けない。パーセント記号がわかりません。
コンテキストでは、コードは次のとおりです。
<?php
}
// activate theme support items
if (function_exists('add_theme_support')) { // added in 2.9
// this theme uses post thumbnails
add_theme_support('post-thumbnails', array('post', 'page'));
set_post_thumbnail_size(100, 100); // normal post thumbnails
// add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
}
// setup different image sizes
if ( function_exists( 'add_image_size' ) ) {
add_image_size('blog-thumbnail', 150, 150); // blog post thumbnail size, box crop mode
add_image_size('sidebar-thumbnail', 140, 140, true); // sidebar blog thumbnail size, box crop mode
// create special sizes for the ads
add_image_size('ad-thumb', 75, 75, true);
add_image_size('ad-small', 100, 100, true);
add_image_size('ad-medium', $width = 250, $height = 250, true );
//add_image_size('ad-large', 500, 500);
}
// Set the content width based on the theme's design and stylesheet.
// Used to set the width of images and content. Should be equal to the width the theme
// is designed for, generally via the style.css stylesheet.
if (!isset($content_width))
$content_width = 500;
// This theme supports native menu options, and uses wp_nav_menu() in one location for top navigation.
function appthemes_register_menus() {
register_nav_menus(array(
'primary' => __( 'Primary Navigation', 'appthemes' ),
'secondary' => __( 'Footer Navigation', 'appthemes' ),
'theme_dashboard' => __( 'Theme Dashboard', 'appthemes' )
));
}
add_action( 'init', 'appthemes_register_menus' );
//ajax header javascript builder for child categories AJAX dropdown builder
function cp_ajax_addnew_js_header() {
global $app_abbr;
$parentPosting = get_option($app_abbr.'_ad_parent_posting');
// Define custom JavaScript function
?>
サムネイルのサイズ変更機能をそのままにして、幅 100%、高さ 100% にサイズ変更する別のコード行を追加するにはどうすればよいですか? 現時点では、頑固なサムネイルを除いてページ全体のサイズが変更されています。
何をすべきか教えてください。
ありがとう。