It plan on extending WordPress to support creating music lead sheets using a ChordPro type syntax. This syntax uses square brackets to enclose tags describing music attributes of a song (eg. [Title], [Composer], [Tempo]) in addition to chord names (eg. [Amaj7]).
It appears that a plug-in can be created which will allow extending WordPress without hacking the source code. Requirements and questions to resolve:
- Songs must be easily linkable from multiple locations since songs are used repeatedly and I don’t want to have to cut/paste the song source every time it is used.
- Provide all the capability of the current custom PHP songs pages on TheRockBand.org:
a. Allow display of songs for a given date showing sequence, etc.
b. Associate with an MP3 file.
c. Provide alternate displays, for example “List all songs alphabetically”
In addition to providing the existing functionality, it will be good to allow comments/discussions regarding each song, with searchability for previous comments made about a given song.
Plug-In creation steps:
- Create name to use for main .php file and folder for additional files
How about “LeadSheet” or “ChordSheet”?
This file and folder will need to be copied to wp-content/plugins/ during installation.
- Create a readme.txt if I want to publish to wordpress.org/extend/plugins.
- Create a homepage for distributing the plugin. Maybe on Lisles.net/LeadSheetPlugin?
- Modify main .php file to add plugin API hooks as needed.
- Adhere to the WordPress coding standards.
- Support Inline Documentation.
- Ensure unique names for all functions, etc. Alternatively, encapsulate them in a class.
- Do not hardcode “wp_” prefix. Use $spdb->prefix variable instead.
- Minimize DB writes.
- SELECT only what is needed.
- Use add_action in the global execution space to hook actions to new functions.
- Use add_filter in the global execution space to hook filters to new functions.
Data is passed to the new function, and modified data or NULL returned.
It may be better to use a “Page” for each song. Need to investigate how to create and link to pages, etc. The down side may be that Pages don’t use the database, and I like the idea of keeping songs in the database instead of as separate files.
Another possibility is to use a Template Tag.
A plugin Filter might be used to format the ChordPro data prior to display.
A plugin Action might be used to syntax validate a new song upon entry.
This might include allowing cut/paste of existing chord sheets that put chords on a separate line above the lyric lines, and then converting them to ChordPro format.
Provide an Admin display to provide buttons for various chord types and song fields.