WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] Description or Cutsom Fields underneath Image in Gallery (2 posts)

  1. FrAgFo0d
    Member
    Posted 1 year ago #

    Hey All,

    I am using the NextGen Gallery and am happy with it, however one thing I just can't seem to get this done right.

    This is what I have right now:
    An album with 10 galleries. When I go to one of these galleries I see all the pictures, but do not see the description underneath the image.
    Only when I click on the image I can see more information.

    How can I get this information to show up underneath the image in the gallery?

    Best for me would be to create custom fields and show these underneath the image in the gallery. I found a add-on for NextGen with which you can create custom fields, but these won't show up either underneath the image.

    Please help I would really like to use NextGen and not some sort of buggy image gallery from somebody else.

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. FrAgFo0d
    Member
    Posted 1 year ago #

    I found the solution for this. It takes some effort but will work.

    Here are the steps:

    1) Install NextGen Gallery and activate it.
    2) Install NextGen Gallery Custom Fields and activate it.
    (http://wordpress.org/plugins/nextgen-gallery-custom-fields/)
    3) In your theme create a directory called nggallery
    e.g. /var/www/wp-content/themes/yourtheme/ngggallery
    4) Copy the gallery.php file from the NextGen Gallery view directory to your nggallery directory in the theme directory:
    e.g. cp /var/www/wp-content/plugins/nextgen-gallery/view/gallery.php /var/www/wp-content/themes/yourtheme/nggallery/
    5) Copy the NextGen Gallery stylesheet to you theme directory
    e.g. cp/var/www/wp-content/plugins/nextgen-gallery/css/nggallery.css /var/www/wp-content/themes/yourtheme/

    Now you still did nothing yet, since you only created your own layout and installed the option of creating custom fields for NextGen Gallery.

    Now before I continue please have a look at the FAQ for the NextGen Gallery Custom Fields (see link above) and setup some custom fields for the galleries.

    I personally created a gallery with all employers and setup these three custom fields:
    - Name
    - Function
    - Phone

    In the Gallery you will now find these fields behind every picture. I entered some data here and now we want this to show up in the gallery itself.

    Here is how we do this:

    6) Alter the gallery.php file you just copied to your nggallery directory (step 4).
    7) Now the Custom Fields addon does something with your images object and places it's own custom fields array in there you can call it like this:
    $image->ngg_custom_fields
    8) Now loop through this in a foreach loop to get the Key (Custom field name) and Value (value) and show this online. I did this:

    <?php
    foreach ($image->ngg_custom_fields AS $key => $value) {
    echo "<span>";

    switch ($key) {
    case "Name":
    echo "<strong>$value</strong>";
    break;

    case "Function":
    echo $value;
    break;

    case "Telefoon":
    echo "$key: $value";
    break;

    }

    echo "</span>";
    }

    ?>

    And placed these at the bottom of the <div class="ngg-gallery-thumbnail" > div.
    just before </div>

    Hope this helps another as well!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic