WordPress Update

I updated WordPress to version 3.2 and switched to the Twenty Eleven theme.  All my plugins have been updated.  Problems with child themes have not been resolved.  At this time I just edited the parent theme to insert the code that would normally reside in the child theme.  Seems to work just fine.  Another mystery of the universe.

Note to self: The code to register custom taxonomies is inserted at the very top of the parent theme’s functions.php.  This would be the same order that a child theme’s functions.php would be executed.  Why it works there and not in the child theme’s is a mystery.

Child WordPress Theme

Today I noticed that the Arjuna-X Theme has yet another update.  Based on the last update, I would expect my custom taxonomies to break with the update, until I edited the theme to add them back in.  I researched the question, “Can I customize a theme and have the changes persist when the theme is updated?”

The answer is “yes”, and the means to do this is the Child Theme.  I promptly created a child theme with a functions.php file that registered my custom taxonomies.  Child theme functions are loaded in addition to the parent theme functions.  Since I’ve already modified Arjuna-X to add my custom taxonomies, I am not sure what would happen when the child theme redefined existing functions.  This seemed like an excellent opportunity to run an experiment.

  1. Create a new Arjuna-X-Child theme and upload to the server.  Do not activate it yet.
    1. A child theme requires a style.css file.  Since I am not making any changes to styles, I used the

      @import url(“../arjuna-x/style.css”);

      statement to bring in the parent Arjuna-X styles in their entirety.

    2. Create a new functions.php file containing the code to register custom taxonomies.
  2. Update Arjuna-X.  This should cause my custom taxonomies to stop working.  Result: As expected, custom taxonomies stopped working.  I noticed that the theme update instructions in my blog dashboard recommend using child themes for modifications.  Funny how I did not notice that last week.
  3. Change blog theme to Arjuna-X-Child.  Custom taxonomies should begin working again.  Result: my child theme showed up in the dashboard.  I activated it and custom taxonomies are back.  That was easy!
  4.  

Not so easy after all. The child theme broke the admin functions.  Login no longer works.  I had to revert back to the basic Arjuna-X theme and modify it, as before.

Time to continue the experiment.  The Arjuna-X functions.php file is quite complex and difficult for me to read.  I wonder if it is not structured in a way that is incompatible with the child theme I’m trying to create.  Hypothesis: The Twenty Ten theme will maximize compatibility, because it is developed as the default theme for WordPress.

The experiment proceeded as follows:

  1. Activate Twenty Ten as the blog theme.  Result: Appears to work as desired.  Theme does not have as many features as Arjuna-X does.
  2. Create a Twenty Ten Child theme and activate it.  This should add my custom taxonomies to the dashboard.  Result:  Blog displays OK, but when I attempt to Log Out, the dreaded “Cannot modify Header” warning appears.  I reset the active theme as Twenty Ten.
  3. Delete functions.php from the child theme.  This leaves only style.css.  Activate Twenty Ten Child theme.  Result: I was able to log out and back in.  No change in appearance from parent theme; working as expected.
  4. Add in the functions.php file exactly as shown in the WordPress example.  Result: The “Cannot modify header information” fault is back.  It appears that child themes are not working for some reason.
  5. I modified the function.php in the child theme to contain only <?php ?>.  No white space before or after the code.  Result: Problem persists.

At this time, I cannot use a child theme with a functions.php file.

2 May 2011 Update. I keep trying things, as this situation is bugging me.  A search of WP Forums gave a clue that perhaps a plugin is interfering with a child theme.  I disabled all plugins, but it did not help.

7 July 2011 Update. Lots of non-adventure life going on, so I haven’t done anything with the blog for a couple months.  I’m going to give up on child themes as I cannot figure out why I can’t get them to work.  I’ll have to get my taxonomies working by editing the main functions.php.  Then I’ll re-enable the plugins I had disabled a couple months earlier.

Because I don’t work with WordPress every day, I’ll document the steps I take in detail; that will help me later to remember what I did.

  1. I could not log in to edit the blog due to the “Cannot modify header information” fault from May.  Using FTP, I renamed the “twentyten-child” folder to “xxtwentyten-child”.  A page refresh displayed the dashboard.
  2. Since the twentyten theme is in fact simpler than Arjuna-X, I decided to try implementing my custom taxonomies in twentyten.  The hope is that it will be easier to learn the inside workings of WordPress.  First I copied the taxonomy code from my backup of Arjuna-X, then pasted it at the end of the functions.php file of twentyten, being careful not to leave any white space at the end of the file.  My custom taxonomies were back!
  3. In the process I noticed that WordPress 3.2 was out, and that it requires PHP 5.2.4 and MySQL 5.0.  I went to my ISP admin panel to verify the required versions were running.  MySQL was at 5, but PHP was version 4.  I changed PHP to version 5 (the exact version is 5.2.17).  This got me to wondering whether the old version of PHP was responsible for the troubles I’d been having with child themes.  So I ran another experiment.
    1. Verified that the twentyten-child functions.php file contained only the PHP start tag and a comment.
    2. Activated twentyten child theme.
    3. Better … the error is gone, but the theme does not display properly.  No widgets.
    4. I had been importing the style.css file in the child theme.  Now I deleted that file and copied style.css from twentyten to twentyten-child.  Now the child theme works just like the parent, widgets and all.
    5. Last step is to add in the functions.php file to the twentyten-child directory.  I did this and the custom taxonomies reappeared.  Yay!
    6. OK, not so Yay.  I seem to have duplicated the original problem. :(

Summary


I’ll summarize for the next time I come back to this.

Here’s the error line, which gets repeated multiple times:

Warning: Cannot modify header information – headers already sent by (output started at /homepages/9/d271285184/htdocs/wp-content/themes/twentyten-child/functions.php:1) in /homepages/9/d271285184/htdocs/wp-login.php on line 354

The error gets flagged on the first line of the child theme’s functions.php.  I know the problem is there because the line number (functions.php:1 in the example above) changes if I insert blank lines at the start of the file.  Here is the beginning of functions.php:

<?php
/**
 * Register custom taxonomies
*/

Environment

WordPress version:  3.1.2

PHP version:  5.2.17

MySQL version: 5.0

Parent theme: Twentyten

All plugins are disabled.

Symptoms

  • Problem manifests during admin type functions, such as login, logout, and editing of posts.
  • Problem is always associated with the PHP start tag in the child theme’s functions.php file.  Line number of the warning moves with the start tag as blank lines are added to start of file.
  • Problem does not manifest if the code in functions.php is directly added into the parent theme’s functions.php.
  • Problem does not manifest for non-admin functions such as navigating posts.
  • Problem does manifest for leaving comments.  Comment will post, though the error occurs.  No problem if there is no functions.php in the child theme folder.

Troubleshooting

  • Using the latest versions of PHP and My SQL.
  • WordPress 3.1.2 should not have this problem.  I will update to 3.2 soon, but don’t expect anything to change.
  • The child theme’s functions.php has no white space at the end.
  • Tried with and without a closing PHP tag.  No difference.
  • Found some comments on the net that the opening PHP tag should have a trailing space.  Tried with and without; no difference.  Also tried the opening tag using the two variants below, also with and without trailing spaces, with no difference.
<?
<?php
  • My text editor allows end of lines to be of three variants.  I tried all three without effect:
    • Unix (LF).  My server is Linux so this should be the best choice.
    • Mac (CR).
    • Windows (CRLF)
  • I suspected a permissions problem.  Admin functions and leaving comments differ from browsing posts by writing data.  So I tried the following:
    • Add group write privilege to wp-content folder and contained files.  Did not help.

Files

Here are the files in the child theme folder:
style.css

/*
Theme Name: Twenty Ten Child
Description: Child theme for the Twenty Ten theme.  Adds custom taxonomies.
Author: Andy Arkusinski
Template: twentyten
*/

@import url("../twentyten/style.css");

functions.php

<?php
/**
* Register custom taxonomies
*/
add_action( 'init', 'create_my_taxonomies', 0 );

function create_my_taxonomies() {
register_taxonomy( 'place', 'post', array( 'hierarchical' => false, 'label' => 'Place', 'query_var' => true, 'rewrite' => true ) );
register_taxonomy( 'history', 'post', array( 'hierarchical' => false, 'label' => 'History', 'query_var' => true, 'rewrite' => true ) );
register_taxonomy( 'activity', 'post', array( 'hierarchical' => false, 'label' => 'Activity', 'query_var' => true, 'rewrite' => true ) );
register_taxonomy( 'device', 'post', array( 'hierarchical' => false, 'label' => 'Device', 'query_var' => true, 'rewrite' => true ) );
register_taxonomy( 'software', 'post', array( 'hierarchical' => false, 'label' => 'Software', 'query_var' => true, 'rewrite' => true ) );
}

Custom Taxonomy Issues

Today I upgraded the Arjuna Theme I use for my blog.  Looking at my blog after, I noticed that all the tag clouds for my custom taxonomies: Places, History, Activities, Gadgets, and Software were referencing basic post tags instead of my custom categories.  It took some time to find the problem.  This is a note to myself in case it happens again.

  1. Custom Taxonomies are added into the functions.php file.  When I upgraded Arjuna, the code that created my custom taxonomy functions was over-written.  When I put it back, custom taxonomies returned.
    • I had a backup of the modified Arjuna Theme on my HD.  I was able to find, copy, and reinsert my code into the theme functions.php file.  I gave myself a pat on the back for keeping a local copy of the modified theme.
    • I vaguely recall there is a way to insert custom functions into WordPress in such a way that they are not over-written by the theme when it is updated.  However, because I did not write such a note as this to myself at the time, I can’t recall the details.
  2. After fixing the taxonomies, the blog displayed a 404 Error when searching for specific taxonomy values.  The solution is to visit the Settings -> Permalinks page from the WordPress Dashboard.  Thanks to Sean Behan for the tip.

Researching Watermarks

I’m looking for some software to put a watermark on the photos I publish in the blog.

Impression for iPhoto

The first watermarking software I looked at was Impression.  The attraction is that this is a plugin for iPhoto.  I assumed that this meant it would seamlessly integrate into my work flow.  Here are my impressions of Impression after using the evaluation version.

  • Impression is easy to install.  I downloaded the disk image, unzipped it, clicked on the install package, and that was it.  I did not like that there was no Readme or other instructions on the install disk.  I usually like to know what goes where before installing.  However, no harm done.  The web site provides installation and uninstall instructions.
  • Impression can use an image in PNG or PSD format, or a text file in RTF format for the watermark.  I used TextEdit to create a copyright notice in RTF format.  Interestingly, once I told Impression where to find the file, changes to the watermark file showed up automatically.  There was no need to do any setup to incorporate a changed watermark file.
  • Impression works in the file export window.  This window gains an Impression tab from which you can select the watermark file, manipulate it in various ways (rotation, margin, transparency, location, scale) (it remembers your selections from session to session), and save the watermarked photo.
  • The save button copies the original image to another one containing the watermark, then imports the watermarked image into iPhoto.  You end up with two images, one with a watermark and the other without.  My test image was a JPG sized at 3.9 MB.  The watermarked image was a JPG sized at 9.8 MB.  That is over twice the size, just for adding a watermark.  The watermarked image is saved to the original file name with “-WM” appended.  For example, IMGP0021.jpg becomes IMGP0021-WM.jpg.
  • Impression does not retain all the meta data from the original photo.  Using the Info window of iPhoto 11, I noticed that the following data is missing or changed.
    • Title was deleted.  It defaulted to the file name.
    • Description was deleted.
    • Location (GPS) was deleted.
    • Camera lens information was deleted.
    • Faces were deleted.
    • Keywords were deleted.
  • Deletion of meta data is pretty much a show stopper for me.  Impression does not seem to fit my work flow at this time.
    • I just want to export photos with a watermark.  Other than the addition of a watermark, the exported photos should be the same as the original in iPhoto.
    • I don’t see the need to store watermarked photos in iPhoto.  Yes, I could delete after exporting, but that is an extra step.
    • Actually, three extra steps …
      • Watermark photos with Impression
      • Export watermarked photos to files
      • Delete watermarked photos from iPhoto
    • When exporting, I use the photo title as the exported file name.  This is much more meaningful in my blog and other programs like EveryTrail than the file name assigned by the camera.  I don’t have to title the photos if the file name is the title.
    • Some web sites I use, such as EveryTrail, locate photos using the GPS location tags.  I don’t use Picasa but I understand it also locates photos based on GPS tags.  I want photos that are watermarked and geolocated, and Impression does not support that.
  • I think what would work for me is a checkbox on the export window that selects watermark or no watermark.  A button next to it would provide access to the watermark setup.
  • Impression retails for $14.90.

iWatermark

The second software I tested was iWatermark.  iWatermark is a stand-alone program, as opposed to a plug-in.  It does have some integration with iPhoto, in that you can select an iPhoto album as the input.  Here are my impressions of iWatermark after using the evaluation version.

  • iWatermark is easy to install.  It comes on a disk image (.dmg) file with the application, a Readme, and instructions for purchasing.  Actually, there are no installation instructions in the Readme; I just dragged the application to my Applications folder and double clicked it to open.
  • iWatermark can process files in PICT, BMP, TIFF, PNG, JPEG, and GIF formats.  It can open even more formats by using Quicktime, according to the documentation.  I tested the JPEG capability because that fits my workflow, and tried DNG format because I was investigating RAW formats at the time.  iWatermark did not process an image in DNG format, though it did not produce an error and did produce an output file that was blank except for the watermark itself.
  • iWatermark includes a watermark editor.  Text is entered directly in the editor, and images can be imported.  The included Help did not list the types of files that could be used for watermarks.  I scanned a folder containing different types of files; .jpg, .gif, and .png files were available, while other types that were clearly not images, such as .pdf and .html were grayed out.
  • iWatermark claims to maintain meta data, and this appears to be the case.  I exported images from iPhoto to JPG format files.  I batch processed the files through iWatermark, creating thumbnails in the process.  Meta Data was preserved in the watermarked files as follows:
    • General, Exif, GPS, and TIFF groups were unchanged.
    • JFIF group added the Progressive tag.
    • IPTC group added the Copyright Notice tag.
    • Meta data was not preserved in the thumbnail images.
  • iWatermark provides the capability to insert IPTC meta data.  I told it to insert the Copyright Notice tag.  It did so without destroying existing IPTC tags.
  • Side observation: iPhoto evidently does not preserve IPTC meta data upon importing images.  I imported images that contained the City, Country, and Province/State tags in the IPTC group.  Exported images contained only Caption/Description and Title tags, to which iWatermark added Copyright Notice.
  • iWatermark can create dynamic watermarks based on meta data, and also create IPTC tags based on meta data.  I did not test this capability.
  • iWatermark retails for $18.00. $20.00 (price increased between when I did the review and when I bought it.)

DropWaterMark

The third software I tested was DropWaterMark.  DropWaterMark is a stand-alone program, as opposed to a plug-in.  It does not have any integration with iPhoto.  Here are my impressions of iWatermark after using the evaluation version.

  • DropWaterMark is easy to install.  On the install disk image drag the DropWaterMark folder to the Applications folder.  First time opening the application presents a configuration screen.  There is a ReadMe, but I did not need to refer to it.  I only opened the ReadMe when I wanted to delete the developer’s logo from the watermark.  However, that cannot be done in the evaluation version.
  • DropWaterMark outputs files only in JPG format.  It will accept files in other formats, but does not list them.  I tried a DNG file but it was not accepted.
  • DropWaterMark allows for two lines of text and an image as watermarks.  Each can be independently positioned, so you could have a watermark in three places, such as a line of text in two corners and an image in the center.
  • Text watermarks are created in DropWaterMark.  Image watermark is imported and then edited within the application.
  • Meta data is preserved as follows:
    • General, JFIF, TIFF groups are unchanged.
    • Exif group added the Color Space tag with value Uncalibrated.  I’m not sure where the value for this tag comes from.
    • GPS group added the GPS Version tag.  Value is set to 2.2.  I found this interesting as there did not seem to any way DropWaterMark could have gotten the value for this tag.  It seems to have been made up.
    • IPTC group added the Keywords tag with no values.  I could find no way to specify keywords to be added.  Also, no way to specify IPTC tags to be added.
  • No capability to create dynamic watermarks or IPTC tags based on meta data.
  • DropWaterMark can change nonvisual data such as creation date, modification date, and file comment.  It can do this as part of watermarking the image, or separately without changing the image.
  • I tried dropping a file on the application icon.  This opened the app and loaded the image, but there were manual steps involved in completing the watermark process.  I was hoping drag-and-drop would work completely automatically.
  • DropWaterMark retails for $16.50.

ImageWell

Finally I tested ImageWell.  ImageWell is more than just watermarking software.  It also has the capability to edit photos, including a simple method of annotation.  This immediately got my attention as my current method of annotating images takes a lot of steps.  Here are my impressions of ImageWell using the evaluation version.

  • ImageWell is easy to install.  Just drag the app to the Applications folder.
  • Running ImageWell is easy as well.  A little window sits on the desktop to which you drag images.  It took me a few minutes to get used to the interface, but after that everything worked intuitively.
  • Surprisingly, ImageWell accepted an image in .DNG format.  This is an archival file format for RAW images.  Output is only in .JPG, .TIFF, or .PNG.
  • I tried a few simple annotations, arrow and text box.  It was easy and worked as expected.
  • The watermark text had to be retyped every time I worked on a new image.  I’m sure there is a way to make it stick, and ImageWell advertises a batch mode, but I did not test that feature.
  • I was getting ready to really like this product, when I looked at the meta data in the output images.  Meta Data is not preserved.  Bummer!
    • In the General group, the Orientation, Pixel Width, and Profile Name tags were deleted.
    • In the Exif group, all tags except Pixel X Dimension and Pixel Y Dimension were deleted.
    • The GPS, IPTC, and TIFF groups were deleted entirely.
    • The JFIF group had some interesting changes.
      • Density Unit changed from 1 to 0.
      • X Density and Y Density changed from 72 to 1.
  • I like the user interface and annotation capabilities of ImageWell, and the user interface is pretty good.  However, not preserving the meta data is a showstopper for me.  I at least need to have position (GPS) information preserved.
  • ImageWell retails for $19.95.

GeoMashup Locations

I’m learning how to use the GeoMashup plugin for WordPress.  I still think it is a cool plugin, but some frustrations have arisen.  Since I am a complete novice at WordPress, PHP, MySQL, etc., my basic knowledge level may not be high enough to understand the documentation that comes with the plugin.

What’s missing is a GeoMashup for Dummies tutorial.  The plugin author provides a couple basic paragraphs, then dives right into the details of programming the plugin.  So I’m going to document my understanding of what is happening in the plugin.  This will help me, and maybe help others.  Of course, I’m sure my understanding will grow over time.  I’ll try to keep the blog up to date.

Locations

I started out thinking in terms of a map.  The basic object on a map is a location.  I think of a paper map with a push-pin marking the location.  The pin (location) has attributes (latitude, longitude) that are used to locate it on a map.  So I’m thinking I need to get a list of locations into my blog, and I can locate them on a map.

Wrong answer!  WordPress is blogging software.  Its basic objects are posts, comments, pages, and users.  There is no location object, like a push-pin.  What the GeoMashup plugin did was add a location attribute to WordPress objects.  Now a Post object has a Location attribute, etc.

This is a fundamental change in my thinking, and I’m still getting used to it.  The markers on a map represent posts and pages, not locations themselves.

For a trip I’m currently planning, I want to show markers for all the places I’m considering going to.  From that map, I can refine destinations, where to stay and for how long, etc.  Since several people are going, and they are located in various parts of the country, we are using a blog page to coordinate the planning.  At this time, there is no way to get a list of locations into WordPress.  I can only get a list of posts into WordPress.  This means I write a post for each candidate location on the itinerary, and assign a location to the post, so the post can be marked on a map.  This will make the blog look messy.

Maps

GeoMashup has three types of maps.  Here are the definitions from the documentation.

  • Global Maps: Global maps can include multiple located objects in various combinations.
  • Single Maps: These options are like the Global Maps options, but are applied to maps in and of single posts.
  • Contextual Maps: These options are like the Global Maps options, but are applied to maps that are based on a list of posts currently being displayed.

So far I have figured out that the maps work this way:

  • If the page on which the map is displayed does not have a location attribute, the map will display all objects with locations.  Filters can be applied (I’m still learning about them) to select which objects will be displayed.  This is a Global Map.
  • If the page has a location, that location will be displayed on the map.  This is a Single Map.
  • I’m not sure how to use a Contextual Map.  It must be in the documentation somewhere, just waiting for me to get smart enough to recognize it!