Support » Plugin: File Gallery » [Plugin: File Gallery] Custom Media fields in Template?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Aesqe

    (@aesqe)

    hi ljvd 🙂

    you can use the standard WP get_post_custom() function to retrieve an attachment’s custom fields.

    try something like this inside your template:

    $custom_fields = get_post_custom($attachment->ID);
    
    foreach($custom_fields as $key => $values)
    {
    	// skip fields with underscore as their first letter
    	if( '_' != substr($key, 0, 1) )
    	{
    		foreach($values as $value)
    		{
    			echo '<p>[' . $key . '] => ' . $value . '</p>';
    		}
    	}
    }

    Thanks Aesqe 😉

    my issue was most about adding extra information with each image of the gallery.
    Fortunately, your code is pretty clean 😉
    It’s a real pleasure to learn from your code!
    I’m definitely one of your big fans ;-p

    I’ve find the $attachment_id and currently work around it with media tags and my dedicated fields

    Thanks again for this amazing plugin.
    It definitely deserve its 5 stars 42 endorsements 😉

    is there a way to stop the file gallery updates overwriting the templates? It’s never seem my custom templates so i edit the supplied which get over overwritten on every update.

    Dc

    Plugin Author Aesqe

    (@aesqe)

    @jynk: when a plugin is updated, its whole folder gets deleted and all files are replaced with new ones, there’s no way around it.

    where do you place your custom templates? File Gallery looks at the following two locations by default:

    1) your-theme-directory/file-gallery-templates
    2) wp-content/file-gallery-templates

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: File Gallery] Custom Media fields in Template?’ is closed to new replies.