
內容簡介
使用Theme Blvd Framework 2.2+版本的佈景主題時,此外掛可讓您更改佈景主題的圖片大小。
這個外掛適用於誰?
此外掛主要針對非開發人員所設計,這些人想要改變其Theme Blvd佈景主題的圖片大小,但沒有必要的開發知識來從其子佈景主題手動進行更改。
這個外掛是如何運作的?
與任何WordPress佈景主題一樣,我們使用WordPress的add_image_size功能,為每個裁剪大小設置圖片大小。然而,在這些圖片註冊之前,Theme Blvd framework會對要註冊的尺寸數組應用過濾器。
這允許輕鬆從子佈景主題或外掛過濾佈景主題的所有圖片大小...這就是利用它的外掛示例。 :)
我必須使用此外掛來更改圖片大小嗎?
不用。實際上,如果您了解PHP的基本知識和WordPress篩選器API,我建議您不使用此外掛,而是直接從子佈景主題的functions.php手動進行更改。在現實中,運行此外掛需要消耗您服務器的額外資源,而這可以通過從子佈景主題手動進行所需變更來避免。
如果您想要深入了解一下開發操作並完成此外掛的要點,您只需從子佈景主題中執行以下操作即可:
function my_image_sizes( $sizes ) {
$sizes['slider-large'] = array(
'width' => '960', // 您的新寬度
'height' => '350' // 您的新高度
);
return $sizes;
}
add_filter( 'themeblvd_image_sizes', 'my_image_sizes' );
外掛標籤
開發者團隊
原文外掛簡介
When using a theme with Theme Blvd Framework version 2.2+, this plugin allows you to change your theme’s image sizes.
Who is this plugin for?
This plugin is mainly designed for non-developers who want to alter the image sizes for their Theme Blvd theme, but do not have the necessary development knowledge to manually make the changes from their child theme.
How does this plugin work?
As in any WordPress theme, we setup the image sizes by using WordPress’s add_image_size function for each crop size. However, before these images are registered, the Theme Blvd framework applies a filter to an array of the sizes to be registered.
This allows for all of the image sizes of the theme to be easily filtered from your child theme or from a plugin… and this would be an example of a plugin that utilizes that. 🙂
Do I have to use this plugin to change image sizes?
Nope. In fact, if you understand the basics of PHP and the WordPress filters API, I would suggest that you do not use this plugin and instead, you manually make the changes from your child theme’s functions.php. Realistically, running this plugin requires extra resources on your server that can be avoided by just manually make the change you want from your child theme.
If you’d like to dive into a little development action, and accomplish the gist of what this plugin does, you’d simply do something like this from your child theme:
function my_image_sizes( $sizes ) {
$sizes['slider-large'] = array(
'width' => '960', // Your new width
'height' => '350' // Your new height
);
return $sizes;
}
add_filter( 'themeblvd_image_sizes', 'my_image_sizes' );
