How It Works
In no particular order, some notes about what you can do here.
Required Plugins
The Exec-PHP plugin is necessary. Really doesn’t matter which one as long as it runs php code within the posts. The english/japanese switch will fail (and really mess up the page layout) if it’s not working for all users. The ‘all users’ requirement meant we had to comment out a couple of lines of code in the plugin, which will need to be repeated if the plugin is upgraded.
If you find “<?php ” anywhere in the source code of a finished page, suspect this plugin.
The English / 日本語 toggle
- Insert ” <?php neoej(); ?> ” in your post where you want the button to appear.
- Begin the English section with ” <?php neoen(); ?> ” and finish it with “</div>”
- Begin the Japanese section with ” <?php neoja(); ?> ” and finish it with “</div>”
- If the finished page looks really strange count your </div> tags
You can duplicate the neoen/neoja tags in the long and short sections, but you only need one neoej() function.
The Author Area
The primary author must be a registered wordpress user, but you can have multiple contributors. Down in the Custom Fields area add whatever key you want, such as “Illustrations by” and a name in the Value area. This will appear exactly as-is (limited html code allowed, no links as it’s already a link) after the author.
IF the name you type EXACTLY matches a user’s Display name AND that user has something in the “About the user” box (Users -> Authors & Users) then that info will be automatically added in the pop-out area. If there’s no match and/or there’s no additional info nothing will appear.
IF the key = Biography the value will NOT appear after the author, but WILL appear in the pop-out. So a one-time contributor should have two entries in the custom fields, one will appear under the main author and the Biography entry will appear in the popout.
The Red and Black lines
Just type [redline] or [blackline] as appropriate, there’s a filter that replaces it with the appropriate code.
(Programmer’s note to self: functions.php -> neoreplace() -> add_filter )
Graphics Functions
LightWindow gallery builder
There is one convenience function to make galleries.
<?php neogallery(“args=values”); ?>
The args are link, major, minor, images, [title], , [author], [folder]
in the format “arg1=value&arg2=value”
major = gallery major title }
minor = gallery minor title } in the popout
link = the main link text people click on
title = master image title at top left
caption = master image caption at bottom left
author = master image author at lower right
folder = folder containing all images based on website root
images =
filename @ title @ caption @ author @ imagelink:
filename @ title @ caption @ author @ imagelink:
only filename is really needed, title, caption, & author are
taken from the master if you don’t specify. leave a blank if you want to drop a middle one e.g.
filename@@ caption@ author:
link is never displayed UNLESS javascript is broken, if you leave it out a sequential number will be inserted.
@-marks separate the line items, colons separate the lines.
unfortunately, as the ampersand has special meaning to PHP you can’t use html entities directly in the code.
Wildcards are allowed in filenames, the title, caption and author are copied for all expanded filenames.
argument order doesn’t matter (except the sub-values for images), and you can have newlines and spaces for clarity
Of course, you can write your own LightWindow links by hand. See the
Using Special Characters
There’s plenty of things you can’t type directly. WordPress interprets a lot of it fairly well, but advanced html processing got turned off to allow other stuff to work. There’s a good list on Wikipedia for anything tricky. If you look at the edit page for this entry there are several examples. One of the most common is < & > ; this had to get typed as “< & >”
The File Structure
Wherever possible, blog feature related things have been kept out of the way of everything else, but this has sometimes required editing package code.
- Theme items are in the
/blog/wp-content/themes/neojapon folder - LightWindow stuff is in
…themes/neojapon/lightwindow, with the
needed images also in that folder. This
required editing the javascript code but not
the LightWindow CSS - All plugins are in the usual place, no
special editing was done. - User uploads go in /images at the site root
(the top of the public_html folder)
Making backups
There are three automatic backup files, one for the database, one for the html code, and one for the uploads.
They are:
- Database: /cgi-bin/backupsql.cgi
- Website code: /cgi-bin/backuphtml.cgi
- Uploads: /cgi-bin/backupuploads.cgi
There was a major issue getting the host’s database to accept japanese text – it was fixed by dropping all the tables, altering the database character set and then reloading the dump table.
Programmer’s note to self:
create: (in mysql)
alter database db_name default character set utf8 default collate utf8_unicode_ci;
dump: (in shell)
mysqldump -u -p --add-drop-table --compatible mysql40 --default-character-set=utf8 --extended-insert
load:(in shell)
mysql -u -p database-name --default-character-set=utf8
Changing the Creation Center
The creation center content is managed through Site admin-> Manage -> Pages -> Creation Center. Use the normal WordPress functions to deal with images. If you inadvertently delete the page, create a new one with the page slug = “creation-center”. Unlike the category placeholders this one isn’t referenced by ID, so deleting it isn’t catastrophic.