I have a gallery that contains both landscape and portrait pictures and want the gallery to be displayed in the wordpress sidebar. The problem is that the thumbnails of the portraits are scaled into landscape format which is unacceptable. Is there a way to exclude portrait pictures? Or is there a way to keep the ratio for such thumbnails in the sidebar widget?
1 Answer
There are several things you could do to achieve what you want.
You could:
- create a new gallery with just the landscape images and include this new gallery into the sidebar;
- try different thumbnail settings in the NGG options (ignore aspect ratio or not, set height and width to the same value and thus show quadratic images);
- edit the file
widgets.php
(which is located inwp-content\plugins\nextgen-gallery\widgets
) in away that only landscape images are shown.
Two things regarding the latter case:
- You can check for landscape images with
if ( $image->meta_data['width'] > $image->meta_data['height'] )
. At a first glance, it seems you have to do your thing inside theforeach
block starting in line 311. - Unfortunately, each time you update NGG, your change will be overwritten. Since NGG does not allow custom templates for the widgets, you cannot just copy the file/folder into your theme directory. So keep a copy of the edit file
widgets.php
(somewhere outside the NGG folder).