Author Topic: Caption won't show up in WordPress caption box  (Read 845 times)

Offline Lyle Aspinall

  • Newcomer
  • *
  • Posts: 7
    • View Profile
Caption won't show up in WordPress caption box
« on: July 16, 2012, 06:46:19 am »
I'll likely ask this same question over on the WordPress forums too, but I'm wondering how or if there's a way to make my PM captions appear in my WordPress captions box. PM captions appear in the WP 'description' box, but that's not where I want them since the description appears in a different area/format than the caption. Any ideas?

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 14963
    • View Profile
    • Camera Bits, Inc.
Re: Caption won't show up in WordPress caption box
« Reply #1 on: July 16, 2012, 07:23:06 am »
They're probably picking up that field from the EXIF Description tag and using that as the WordPress caption.  Photo Mechanic does not write/update the EXIF Description tag.

-Kirk

Offline SK-Foto

  • Hero Member
  • *****
  • Posts: 977
    • View Profile
Re: Caption won't show up in WordPress caption box
« Reply #2 on: July 16, 2012, 07:26:09 am »
Hi!

Wordpress is using the IPTC-Headline as caption and the IPTC-Caption as description

Sven
Canon's 27,9 x 18,6 mm with some black and white lenses -  on Mavericks 10.9 (MBPro and MB Air)

Offline Kevin M. Cox

  • Sr. Member
  • ****
  • Posts: 261
  • PM 5.0 Build 15430 on OS X 10.8.5
    • View Profile
    • Kevin M. Cox | Photojournalist
Re: Caption won't show up in WordPress caption box
« Reply #3 on: July 16, 2012, 09:31:59 am »
Hi!

Wordpress is using the IPTC-Headline as caption and the IPTC-Caption as description

Sven

Good to know Sven! Since we're on the subject, any idea if there is a PM IPTC field that can be used to automatically populate the Wordpress "Alternate Text" area?
Kevin M. Cox | Photojournalist
http://www.KevinCox.com

Offline SK-Foto

  • Hero Member
  • *****
  • Posts: 977
    • View Profile
Re: Caption won't show up in WordPress caption box
« Reply #4 on: July 16, 2012, 09:57:44 am »
Kevin,

I am not aware of any field. I am filling nearly every field with text and an upload to Wordpress does not fill the "Alternate Text" field.

Sven
Canon's 27,9 x 18,6 mm with some black and white lenses -  on Mavericks 10.9 (MBPro and MB Air)

Offline Kevin M. Cox

  • Sr. Member
  • ****
  • Posts: 261
  • PM 5.0 Build 15430 on OS X 10.8.5
    • View Profile
    • Kevin M. Cox | Photojournalist
Re: Caption won't show up in WordPress caption box
« Reply #5 on: July 16, 2012, 10:10:22 am »
Thanks for doing the testing!
Kevin M. Cox | Photojournalist
http://www.KevinCox.com

Offline SK-Foto

  • Hero Member
  • *****
  • Posts: 977
    • View Profile
Re: Caption won't show up in WordPress caption box
« Reply #6 on: July 16, 2012, 10:24:29 am »
May be a bit of digging in the php code of Wordpress could help.
But any future update of WP will kill this.
Sven
Canon's 27,9 x 18,6 mm with some black and white lenses -  on Mavericks 10.9 (MBPro and MB Air)

Offline SK-Foto

  • Hero Member
  • *****
  • Posts: 977
    • View Profile
Re: Caption won't show up in WordPress caption box
« Reply #7 on: July 16, 2012, 11:54:46 am »
If you want to to change the assignment of IPTC fields to wordpress fields you have to modify the following file:

Code: [Select]
/wp-admin/includes/image.php
Begin at line 246 of the current wordpress distribution.

example (line 254 - 256):
Code: [Select]
// headline, "A brief synopsis of the caption."
if ( ! empty( $iptc['2#105'][0] ) )
$meta['title'] = utf8_encode( trim( $iptc['2#105'][0] ) );


This will add the headline into the title field. If you want to have the caption there, replace "2#105" with "2#120"

Procedure to find out the codes to use (tested only on a MAC)
take an image that has already all your informations in, copy it somewhere, name it testimg.jpg
open the terminal, CD to your image and type
Code: [Select]
php -a
press enter and paste the following code into the window (interactive PHP interpreter in command-line mode):

Code: [Select]
$size = GetImageSize ("testimg.jpg", &$info);
$iptc = iptcparse($info["APP13"]);

foreach($iptc as $key => $value)
{
    echo "<b>IPTC Key:</b> $key <b>Contents:</b> ";
    foreach($value as $innerkey => $innervalue)
    {
        if( ($innerkey+1) != count($value) )
            echo "$innervalue, ";
        else
            echo "$innervalue";
    }
}

This will give you some "strange" output. You can paste it into any text editor and split the line before each <b>

Listed here are some values I figured out so far:

Code: [Select]
IPTC Key: 2#055 Contents: Date taken
IPTC Key: 2#060 Contents: time taken
IPTC Key: 2#090 Contents: City
IPTC Key: 2#095 Contents: State
IPTC Key: 2#101 Contents: Country
IPTC Key: 2#005 Contents: Title
IPTC Key: 2#015 Contents: Category
IPTC Key: 2#020 Contents: SupCat1, SupCat2, SupCat3
IPTC Key: 2#025 Contents: Keywords
IPTC Key: 2#007 Contents: Edit Status
IPTC Key: 2#080 Contents: Photographer
IPTC Key: 2#110 Contents: Credit
IPTC Key: 2#122 Contents: Description Writers
IPTC Key: 2#120 Contents: Caption
IPTC Key: 2#105 Contents: Headline
IPTC Key: 2#040 Contents: Special Instructions
IPTC Key: 2#116 Contents: Copyright
IPTC Key: 2#092 Contents: Location

Hope this helps a bit.
« Last Edit: July 16, 2012, 11:58:21 am by SK-Foto »
Canon's 27,9 x 18,6 mm with some black and white lenses -  on Mavericks 10.9 (MBPro and MB Air)