WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Custom Fields
Problems with NextGen Custom Fields and Elliot Theme (4 posts)

  1. derekshirk
    Member
    Posted 2 years ago #

    I am trying to use the NGG Custom Fields plugin and everything is working well - except...In the theme I'm using (Elliot - Themeforest) the theme author set up the image to open in a full screen view onclick. In the full screen view the default Title and Description are being called like this (from a custom.js file):

    // set the description from the image at the description holder
        function setImageDescription(title, desc){
        	$('#image-description .title').text(title);
        	$('#image-description .desc').text(desc);
        	    	return false;
        }

    Then there is a placeholder div # named image-description located in the header.php file. This div is either assigned a .hide or .show depending on the users actions:

    <!-- image description -->
    		<div id="image-description">
    			<h2 class="title"></h2>
    			<div class="desc"></div>
    		</div>
    <!-- ENDS image description -->

    I want to add too more values from the new custom fields I created using this plugin but I don't understand how to insert them into the #image-description div using the method above. I guess I don't understand the .text(title) and .text(desc) part.

    How can I do something like:

    $('#image-description .occupation').text(THE OCCUPATION CUSTOM FIELD DATA FROM PLUGIN HERE);

    (the two custom fields I am trying to implement are Photographer Name and Occupation)

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

  2. shauno
    Member
    Plugin Author

    Posted 2 years ago #

    Without looking at the full code, it would seem that setImageDescription() gets called somewhere, passing the title and description. How those are passed is the key. You should easily be able to add extra arguments to the function, and the extra markup to place the content into.
    It's going to be all about how setImageDescription() is called. You might need to add hidden fields or something somewhere to persist the custom field values through to external js files.

  3. derekshirk
    Member
    Posted 2 years ago #

    ok. I think this is the full code that controls the setImageDescription:

    // set the description from the image at the description holder
        function setImageDescription(title, desc){
        	$('#image-description .title').text(title);
        	$('#image-description .desc').text(desc);
        	return false;
        }
    // set description
    img_title = $(this).attr('title');
    img_desc = $(this).children('img').attr('alt');
    setImageDescription(img_title, img_desc);

    I'm afraid even seeing this I don't know where to begin adding my 'photogrpher name' and 'occupation' custom fields.

  4. shauno
    Member
    Plugin Author

    Posted 2 years ago #

    It gets the title and desc from the title and alt attributes in of the actual image tag. You can just add arbitrary extra params, but that won't validate.
    You could add hidden elements (spans I guess would work) with the extra data, and the pass that through to setImageDescription() as extra args as my last post.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic