WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Nextgen custom fields (5 posts)

  1. farouchia
    Member
    Posted 4 years ago #

    I am trying to use this wonderful plugin, but without success. Where do I have to put the tags after all? I guess it's not directly in my page. Ii probably is in the php files?

    Can someone give a hint on where I must put the tags to have the fields appear beside te gallery pic?

    Thank You!

  2. mygraphicfriend
    Member
    Posted 4 years ago #

    You must put the tags in the template file: gallery.php (look for this file in folder /wp-content/plugins/nextgen-gallery/view/)

    When you modified this file, you may want to save a copy of it to your theme directory (create a folder named /nggallery/ in your theme folder, and put the file in this folder, WP will look into your theme folder and find this file to use first) , and keep the original in the plugin folder, so that when you need to upgrade the plugin, your custom template won't be overwritten.

    Here's an example:

    I created a custom field called "Artist bio", so I put a line in gallery.php to display this field:
    <p><?php echo nggcf_get_gallery_field($gallery->ID, "Artist Bio"); ?></p>

    Hope that helps.

  3. farouchia
    Member
    Posted 4 years ago #

    Thank you so much mygraphicfriend!

    I really did not find such a clear explanation on the plugin page! I am going to try that right away!

    Thank you again!

  4. farouchia
    Member
    Posted 4 years ago #

    Well...no luck. Nothing appears on my gallery page. But I am using the simple viewer with my Nextgen gallery...Could it be why?

    Also the author says to add this <?php echo $image->ngg_custom_fields["Your Field Name Here"]; ?> which is a different code that the one you suggested. Are we talking about the same plugin? NGG Custom Fields?

    And when I open gallery.php in WP, I can see (inactive) beside the name of the file. Does that mean that this file is not being used with my current setting?

  5. mygraphicfriend
    Member
    Posted 4 years ago #

    Displaying Fields:

    For image custom fields, use the following tag:
    <?php echo $image->ngg_custom_fields["Your Field Name Here"]; ?>
    For gallery custom fields, use the following tag:
    <?php echo nggcf_get_gallery_field($gallery->ID, "My Gallery Field Name Here"); ?>

    The tag I used is for a gallery field.

    The reason it didn't work for you may be because you do not use the default template, which is controlled by gallery.php. You said that you used Simple Viewer, I haven't looked to see which template file should that be, so I can't tell you. But you need to put the tags into the correct template file to make it work.

Topic Closed

This topic has been closed to new replies.

About this Topic