Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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).
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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