NextGEN Gallery
Number of columns for each page (9 posts)

  1. Laudde
    Posted 4 years ago #

    Hello all,

    I am using NextGEN Gallery which is a great plug-in for your albums etc. It has a lot of options, one of them is Number of columns.

    I was wondering, is it possible to set the Number of columns for each page? I have some gallery's where I want only 3 colums and an other page with 6 coluns. (It is possible to set it to 0 but that everything mess itself up.)

    So where in the code do I have to make some changes?


  2. Toshi Yoshida
    Posted 4 years ago #

    It looks like the column control display code is in /nextgen-gallery/view/ directory? Which file to edit depends on which gallery shortocde you use. As I use the gallery-caption option I'd have to edit the gallery-caption.php file.

    You could hardcode some/all gallery names setting some/all with a column value. Or, avoid hardcoding names by naming your galleries with a suffix like -3 and -6. When the updated code runs it could check the suffix and set the number of colums accordingly. That way the code doesn't need updating each time you add a new gallery.

    I don't know php so cant help with that part.

  3. Laudde
    Posted 4 years ago #

    Thanks for your reply mikeg9999,

    I am just using [nggallery id=x]
    It would be nice to change the shortcode with a suffix like this:
    [nggallery id=x col=3]

    I found in the following code in /nextgen-gallery/nggfunctions.php

    // fixed width if needed
        $gallery->columns    = intval($ngg_options['galColumns']);
        $gallery->imagewidth = ($gallery->columns > 0) ? 'style="width:' . floor(100/$gallery->columns) . '%;"' : '';

    If somebody could help me with this, that would be nice. My knowledge of php is also not the best. But I will try it myseld.

  4. Toshi Yoshida
    Posted 4 years ago #

    I like the [nggallery id=x col=3] suggestion.

  5. Jeroen
    Posted 4 years ago #

    Laudde, I was looking for an option like this too. I have fixed this through CSS for now by changing the width. You can see the result here, hope it helps you:

    div#ngg-gallery-X-YYY { width: 370px; float: right; }
    X is the gallery-id and YYY the page-id

    An option to do [nggallery id=x col=2] would be great indeed!

  6. Laudde
    Posted 4 years ago #

    Hi Jeroen,

    Nice job. And than you set columns=0?
    I still want to [nggallery id=x col=2] option. That would be awesome.

  7. Jeroen
    Posted 4 years ago #

    That's right, columns = 0

    However, the option you are suggesting would be better!

  8. robotect
    Posted 4 years ago #

    Please make yourself familiar with the template option like this:

    [nggallery id=1 template=sample1]

    You may google for it, this will solve your problem. Regards, Uli

  9. Toshi Yoshida
    Posted 3 years ago #

    As as follow on from Uli above...

    You can set the number of columns for an individual galley page/post by using the WordPress Custom Fields function and the NextGEN ngg_gal_Columns parameter.

    For example, to have 3 columns you'd edit the gallery page.
    Clck "Add Custom Field"
    Click "Enter New"
    In the Name field enter ngg_gal_Columns
    In the Value field Value= 3
    Then click "Update" to publish to update the page.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • NextGEN Gallery
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic