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

Offline Lyle Aspinall

  • Newcomer
  • *
  • Posts: 8
    • 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: 25459
    • 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 Sven

  • Uber Member
  • ******
  • Posts: 1059
    • 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
sports (swim, bike, run in any combination or alone), animals, sometimes aeroplanes
sony alpha 1, 9, 7III and a bunch of lenses (24-600mm)

Offline Kevin M. Cox

  • Hero Member
  • *****
  • Posts: 561
  • 2025.1 (8239) | macOS 15.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
https://www.instagram.com/kevin.m.cox/

Offline Sven

  • Uber Member
  • ******
  • Posts: 1059
    • 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
sports (swim, bike, run in any combination or alone), animals, sometimes aeroplanes
sony alpha 1, 9, 7III and a bunch of lenses (24-600mm)

Offline Kevin M. Cox

  • Hero Member
  • *****
  • Posts: 561
  • 2025.1 (8239) | macOS 15.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
https://www.instagram.com/kevin.m.cox/

Offline Sven

  • Uber Member
  • ******
  • Posts: 1059
    • 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
sports (swim, bike, run in any combination or alone), animals, sometimes aeroplanes
sony alpha 1, 9, 7III and a bunch of lenses (24-600mm)

Offline Sven

  • Uber Member
  • ******
  • Posts: 1059
    • 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.

[attachment deleted by admin]
« Last Edit: July 16, 2012, 11:58:21 AM by SK-Foto »
sports (swim, bike, run in any combination or alone), animals, sometimes aeroplanes
sony alpha 1, 9, 7III and a bunch of lenses (24-600mm)