WordPress.org

Ready to get started?Download WordPress

Forums

Display Alt Title and Description from NextGen Slideshow (10 posts)

  1. ellewoodward
    Member
    Posted 2 years ago #

    Hello! I'm using the NextGen slideshow with the flash based version not enabled. I have a pop-out jquery panel that lays on top of the image on the home page slideshow only that describes the pictures. I am wanting to display the alt title and description that you type in the admin section of the NextGen Gallery.

    I have called some custom fields on pages and posts to display by inserting the code below in my template file.

    <?php echo get_post_meta ($post->ID, 'project_name', true); ?>

    This however doesn't work to show the gallery code. Can someone please point me in the right direction for the correct code? Thanks!

  2. ellewoodward
    Member
    Posted 2 years ago #

    So I have since used the NextGen Custom Fields Plugin http://wordpress.org/extend/plugins/nextgen-gallery-custom-fields/faq and to place the code throughout my template file I use

    <?php echo nggcf_get_field(237, "ProjectName"); /* where 237 is the ID of the image you want the custom field to show for */ ?>

    This works great for me but I want to call in all four images from this gallery all with different names and descriptions. Does anyone know how to replace the ID of the image to call in every image's information in that gallery?

  3. shauno
    Member
    Posted 2 years ago #

    The author of NGG tends to use $image as his iteration variable in his loops.
    So, it will probably be $image->pid, but if you tell me what NGG template you are using, and what line you have added the tag, and can be more certain.

  4. ellewoodward
    Member
    Posted 2 years ago #

    Shauno, Thank you for your response. I have tried using $image->pid and nothing came into the field. I have gallery.php copied into my template files so it won't be overwritten by an update but I have not actually changed much in that file yet. I have tried adding a custom field link and have played with that in the gallery.php but it hasn't worked for me yet.

    that is on line 42
    'ngg_custom_fields["Link"]; ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >'

    When I put it in my individual php page template files as
    '<?php echo nggcf_get_field(237, "ProjectName");?>' it may not be working as '$image->pid' yet because I haven't referenced $image so far. What code would that be and where would I put it?

    Thanks!

  5. shauno
    Member
    Posted 2 years ago #

    You need to paste code into the code tags (back-ticks) for me to see it properly.

    If you say you aren't using the NGG templates, how are you showing the images?

  6. ellewoodward
    Member
    Posted 2 years ago #

    Sorry I misunderstood what you meant by template. In my index.php file I am calling in the slideshow images with

    <?php echo do_shortcode('[slideshow id=34]'); ?>

  7. ellewoodward
    Member
    Posted 2 years ago #

    And the code I am putting in to call in the custom field is

    `<?php echo nggcf_get_field(237, "ProjectName"); ?>'

    but I am wanting to change out the 237 (image ID) to call in not just one image but every image in the specific gallery

  8. shauno
    Member
    Posted 2 years ago #

    That short code calls the flash slide show. It will fall back to the JS slide show under certain conditions, but that's not really relevant.

    You cannot add extra text to a flash component, so unfortunately you cannot show your custom fields in the slide show.

  9. ellewoodward
    Member
    Posted 2 years ago #

    Shauno, how should I call in a non-flash version of the slideshow so that I can have my custom fields displaying?

  10. shauno
    Member
    Posted 2 years ago #

    You can call the JS slide show like this <?php echo nggShow_JS_Slideshow($galleryID, $width, $height) ?>. Width and height are optional, and will default to your settings. So your example becomes: <?php echo nggShow_JS_Slideshow(34) ?>.

    But that's not actually going to help you. It seems the slide show code looks different to the last time I looked at it. It seems to load the images with AJAX. So it's not just looping through them in PHP.
    This means there is not quick place to just paste a tag and show the custom fields.
    It will require adding to the JSON object, and the injecting the variables into the DOM where you need them.

Topic Closed

This topic has been closed to new replies.

About this Topic