Description and Keywords in WordPress

In order for people to find a website they need some clues as to what the site or page is about. One way to do that is by adding a description and keywords to the site. Since I used to hand code my web pages it was easy enough to add a couple of lines of code to the file in the form of Meta tags. With WordPress there is little coding involved. Most changes are made using plugins or widgets. Occasionally coding can be done to avoid resorting to those tools.

I recently researched how to add this type of information to this website. It involved adding the following code to the file header.php. When doing so WordPress warns you that your modifying the code of the site so be very careful:

<title><?php bloginfo(‘name’); ?><?php wp_title(); ?></title>
<meta name=”description” content=”<?php if (is_single() ) {
single_post_title(”, true);
} else {
bloginfo(‘name’); echo ” – “; bloginfo(‘description’);
}  ?>” />
<meta description=”Bruce’s website with information about bike trips, artwork, and general bike information.”>
<meta keywords=”bicycle, drawing, charcoal, artwork, bike, bike tours, bike trips”>
For individual blog posts, tags can be used to identify important keywords used.

Organizing photos in Mac Photos

When organizing photos in the Mac application Photos I put a long description in the Title of each photo. When moving those photos to WordPress I realized that the Description field was used for captioning photos in a Gallery. Instead of copying and pasting the title of each photo into the description, I searched for a way to do it using a program.

Found an AppleScript for doing a similar operation so after a little trial and error figured out how to move the title to the description field. As it turns out the variable name for the Title is “name.”

tell application “Photos”
activate
set mySelection to (get selection)
if mySelection is {} then
error “Select photos before using script.”
else
repeat with thePhoto in mySelection
tell thePhoto
set the description to the name
end tell
end repeat
end if
end tell