Skip to content

Instantly share code, notes, and snippets.

@Perun
Created June 14, 2013 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Perun/5781665 to your computer and use it in GitHub Desktop.
Save Perun/5781665 to your computer and use it in GitHub Desktop.
Zusätzliche Bilderformate in WordPress definieren und im backend auswählbar machen. Siehe: http://www.perun.net/2013/06/13/wordpress-zusaetzliche-bildergroessen-definieren/
<?php
// Unterstützung für Vorschaubilder sollte schon aktiv sein
add_theme_support('post-thumbnails');
// die gewünschten neuen Bilderformate
add_image_size('vorschaubild', 125, 125, true);
add_image_size('produktbild', 500, 350);
// macht die neuen Formate im Backend sichtbar und auswählbar
add_filter('image_size_names_choose', 'custom_image_sizes_choose');
function custom_image_sizes_choose($sizes) {
$custom_sizes = array(
'vorschaubild' => 'Vorschaubild',
'produktbild' => 'Produktbild'
);
return array_merge($sizes, $custom_sizes);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment