[Plugin: Next-Gen Gallery] Singlepic caption (9 posts)

  1. cipote
    Posted 6 years ago #

    Is it posible to have the description/caption show up for an image using the singlepic option?

    Something like this:
    [ singlepic id=1 caption=desc w=480 h=320 ]

  2. ajg
    Posted 6 years ago #

    We also need to display the description when singlepic is used in a post.
    Any ideas what files to change to get this working?

  3. CrowChick
    Posted 6 years ago #

    I badly need this functionality. I was so sad when I found out there was no obvious way to do that. It would make like so much easier!

  4. ajg
    Posted 6 years ago #

    Any news on this feature?

  5. Bentforkz
    Posted 6 years ago #

    First of all, I am not - by any means - a PHP or WP whiz. I tinkered around with the NGG template files/code until I found a solution that works for me. I hope this at least might get you close to what you are trying to achieve.

    My Solution:

    Step 1. Open the Singlepic.php template file:

    nextgen-gallery > views > singlepic.php

    Step 2. Rename the singlepic.php file to something else like singlepic-caption.php
    (The hyphen caption seems to be the right way to rename the template files. You might find another way to name the files, but this seems to work well for me.)

    Step 3. Add the following PHP call to the code after line 21 of the above file (or really, wherever you want the text to be displayed):

    <?php echo $image->alttext; ?>


    <?php echo $image->description; ?>

    ***NOTE*** I found the alttext version seems to display a little better on my server for some reason. Give both a shot to see which works better for you.

    At this point you should be able to style as needed.

    Step 4. Upload the renamed/edited file to your server.

    Step 5. In a WP post or page, use a new singlepic shortcode including the name of your new template like this:

    [singlepic id=1 template=caption]

    This solution seemed to work for me. I hope it works for you - Good luck!

    ***UPDATE*** Just thought of this: If you are using Float in your single pic shortcode, you may need to style the above call with matching right or left floats in the template/style and then create seperate templates to correspond to your singlepic shortcode float. Again, good luck!

  6. typebee
    Posted 6 years ago #

    hey bentforkz, thank you for this information. I was able to get the caption to show up on the singlepix. However, I don't know how to style it. The caption is too far to the left, not aligned under the photo. I'm using ngg_shadow.css. Do you know what code and where to add it? I tried this:

    .ngg-singlepic-caption {
    text-align: center;
    background-color: #f3f3f3;
    padding-top: 4px;
    margin:0 0 0 118px;
    /* -moz-border-radius: 3px;
    -khtml-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px; */

    I also tried ".ngg-singlepic caption", but it didn't work. I hope you know what I'm doing wrong. Thanks a lot!

  7. John Stone
    Posted 6 years ago #

    bentforkz, Thank you!! This was exactly what I was looking for. :)

    typebee, this is what I did to style the singlepic with caption:

    <div align="center">
    <div class="ngg-thumbnail">
    [singlepic id=57 template=caption w=270]

  8. ajg
    Posted 5 years ago #

    Looks like this feature will never make it to actual code. :(

    Any ideas how to get the damn "description" to display under the image so that we do not have to add div tags in to articles?

    Can you give us detailed instructions how to edit singlepic-caption.php.

    Thank you.

  9. ajg
    Posted 5 years ago #

    Sorry to bump this one.

Topic Closed

This topic has been closed to new replies.

About this Topic