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 1


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 in wp-content\plugins\nextgen-gallery\widgets) in away that only landscape images are shown.

Two things regarding the latter case:

  1. 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 the foreach block starting in line 311.
  2. 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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.