Oct 07

AHP Sitewide Recent Posts – hack 2.1ish

It’s funny how things happen to fall into place. Jacob over at 912Candidates.org was lamenting over the issue of not keeping the main page up-to-date. A few of the state sites have been posting updates, but Jacob has been a little busy and didn’t have anything to put on his front page. If only, he thought, there was a way to show the posts from the other sites. Well, what do you know, I was just playing around with a plug-in that did that. After pointing Jacob to the example on NC Freedom, he came back with some changes. The biggest change that he wanted was to use the flag icon I was using for each site instead of the avatar for the user.

When I created the one off Gold List plug-in for the 912Candidate site, I used avatar images that depict state flags. I decided to be a little creative and spice up the list with these flags and it turned out really well. Initially I had some issues getting the flags to work, because I needed an easy way to get the file name based off of the site. Each state site used the state abbreviation and the file names used the full name of the state. I didn’t want to rename all the image files, so I created an array to hold the values.

[php]
// state list
$stateList = array( ‘AL’ => ‘Alabama’, ‘AK’ => ‘Alaska’, ‘AZ’ => ‘Arizona’, ‘AR’ => ‘Arkansas’, ‘CA’ => ‘California’,
‘CO’ => ‘Colorado’, ‘CT’ => ‘Connecticut’, ‘DE’ => ‘Delaware’, ‘DC’ => ‘District of Columbia’, ‘FL’ => ‘Florida’,
‘GA’ => ‘Georgia’, ‘HI’ => ‘Hawaii’, ‘ID’ => ‘Idaho’, ‘IL’ => ‘Illinois’, ‘IN’ => ‘Indiana’, ‘IA’ => ‘Iowa’,
‘KS’ => ‘Kansas’, ‘KY’ => ‘Kentucky’, ‘LA’ => ‘Louisiana’, ‘ME’ => ‘Maine’, ‘MD’ => ‘Maryland’, ‘MA’ => ‘Massachusetts’,
‘MI’ => ‘Michigan’, ‘MN’ => ‘Minnesota’, ‘MS’ => ‘Mississippi’, ‘MO’ => ‘Missouri’, ‘MT’ => ‘Montana’, ‘NE’ => ‘Nebraska’,
‘NV’ => ‘Nevada’, ‘NH’ => ‘New Hampshire’, ‘NJ’ => ‘New Jersey’, ‘NM’ => ‘New Mexico’, ‘NY’ => ‘New York’, ‘NC’ => ‘North Carolina’,
‘ND’ => ‘North Dakota’, ‘OH’ => ‘Ohio’, ‘OK’ => ‘Oklahoma’, ‘OR’ => ‘Oregon’, ‘PA’ => ‘Pennsylvania’, ‘RI’ => ‘Rhode Island’,
‘SC’ => ‘South Carolina’, ‘SD’ => ‘South Dakota’, ‘TN’ => ‘Tennessee’, ‘TX’ => ‘Texas’, ‘UT’ => ‘Utah’, ‘VT’ => ‘Vermont’,
‘VA’ => ‘Virginia’, ‘WA’ => ‘Washington’, ‘WV’ => ‘West Virginia’, ‘WI’ => ‘Wisconsin’, ‘WY’ => ‘Wyoming’ );
[/php]

By having the array, I could always add more values or use either the initial to get the name or the name to get the initial.
I updated the code to search through the array and match up a substring of the blog link to the state abbreviations. If an abbreviation matched, then the code for adding the image is added to the variable. I replaced the avatar variable value with this new variable. It makes for a nice effect on the main page of 912Candidates.
[php]
foreach ($stateList as $abbr => $stateName){
if($abbr == strtoupper(substr($blog_link,strpos($blog_link,’org’) + 4, 2))){
$this_blog_image = ‘<img src="/resources/flags/’ .
$stateName .
‘.gif" height="55" width="55" border="0" align="left" style="padding-right: 5pt;" />';
}
}
[/php]

Aug 20

Testing the syntax highlighter

So, I added this awesome plugin called SyntaxHighlighter Evolved that converts code into a pretty look on the blog. The reason for using this is obvious to any developer. It’s a real pain in the butt to convert code so that it will display in HTML. And you want to display code every now and then to show off your geek fu or just to complain about some code that was bugging you.

Let’s see if my new buttons work. Basically, I am using WP-Quicktag to easily add QuickTags to a post. For the SyntaxHighlighter I decided to add two QuickTag buttons. One for ActionScript 3 and one for JavaScript, since they are the code types I use most in my custom development. The buttons place the QuickTags around the text I want to show as code.

This is an ActionScript 3 code example [code][as3]Your Code Here[/as3][/code]:
[as3]public function initApp():void
{
oneMinuteTimer.addEventListener(TimerEvent.TIMER, oneMinuteTick);
oneMinuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, resetOneMinute);
oneMinuteTimer.start();

twoMinuteTimer.addEventListener(TimerEvent.TIMER, twoMinuteTick);
twoMinuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, resetTwoMinute);
twoMinuteTimer.start();

fiveMinuteTimer.addEventListener(TimerEvent.TIMER, fiveMinuteTick);
fiveMinuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, resetFiveMinute);
fiveMinuteTimer.start()
}[/as3]

And this is a JavaScript code example [code][js]Your Code Here[/js][/code] :
[js]function findPlayListItem(fileTitle) {
var outItemId = 0;

playlist = player.getPlaylist();
if(playlist) {
var thisTitle = ”;
for(var listItem in playlist) {
thisTitle = playlist[listItem].title;
if(thisTitle == fileTitle) {
outItemId = listItem;
}
}
}
return outItemId;
}[/js]

The simplicity of adding these little blocks around the code to save a ton of time is one of the great things about WordPress. Now if I can only find a quick way to update any old posts with code in it.

Aug 13

Updates and updates

WordPress has been making more updates lately than a backstage of a Las Vegas review.  Since the automatic update hasn’t worked in a few attempts, I have been forced to update manually by finding the files that are updated and uploading them to the site.  Hopefully I am finding all the files and doing all the updates.  I guess when they do their next big release, I’ll do a complete update of all of the files just to be on the safe side.

One issue with the updates is that if you create plugins, like I do, then you have to verify that your plugin works with the new update.  This usually isn’t a difficult task when you have a demo page on your site.  Just go to the page and see if it still works.  That was the step I took with my Mixed Tape plugin. However, as a plugin creator, you aren’t done there.  In order for someone to feel a little more comfortable about your plugin, you have to keep the “Tested up to:” version up-to-date.  Updating this information on your plugin requires an update to the “readme.txt” file and then a checkin to the source control database.  Apparently I’m getting better at it, because I am not reloading the files up multiple times.

What prompted me to make my plugins compliant with the new version of WP was a suggestion in my forum about a change to the WP People plugin.  The user wanted to customize the title or hover text on the link to the WP People bio.  I thought that was a great idea and now I found a little time to tackle the request.  While I was coding away, I changed the code around to work a little more like a plugin I made for 9/12 Candidates.  And, I also removed the table html that creates the layout for the form.  The changes aren’t major, but they weren’t minor either.  Hopefully it will allow me to do updates to that plugin much easier in the future.

But of course, my two little plugins are free, so I don’t see myself making a living off of WordPress plugins, even though a few developers get some money.

Apr 09

svn causing me heartburn

Arrrghh!!

So, the Plugin Directory finally pushed the 1.1.0 version of my Mixed Tape plugin to the repository to download. After I upgraded the plugin through the admin Dashboard, I noticed that the players were not showing in the test page. Well, apparently the svn check in blew up when I tried to add the 1.1.0 version and never put the audio files up to the site. I copied the audio directory from the trunk, which is apparently a no no. So, from now on I will have to remember to copy it from my working directory, which happens to be my local directory of my site.

I know some people have demo sites of their blogs. I really never thought I would have to worry about that, until now. I really don’t want to go through the hassle of setting up a duplicate blog just for testing, but it might come to that. My blog doesn’t get much traffic, but who knows, with the plugins and the Meetup Organizer Tool, it might just start.

Anyway, I’ve released 1.1.1 of the Mixed Tape and I see that the audio directory is under that version. I guess this will also be a good test to see how the tags/revisions work. Since the audio folder wasn’t in 1.1.0, then there will be a definite change between the two version. Of course, I will have to wait until it gets pushed through the repository, however long that will take.

Apr 08

An ah ha! moment

So, I apparently didn’t get enough sleep last night and my brain isn’t working on all cylinders. Anyway, it hasn’t stopped me from some side brain storming. Since I finally got my Mixed Tape plugin to show up on the plugin directory, I guess I was thinking about the type of people who might use it. I shared it with one of the guys over at Music Brainz, who plans to do a little write-up about the plugin. I guess that was in the back of my head, because it came to me that people who review music could use the plugin. Of course, that might have nothing to do with a music database, but it might. I bet there are plenty of people who write-up reviews about the latest album from their favorite artist, before they submit it to Music Brainz.

Since the plugin basically just takes the tracks and makes a playlist a reviewer could discuss each of the tracks on the album and link to the track as the review goes along. So, when they are done, someone could listen to the track and see if they have the same impression as the reviewer.

So, this means I probably need to make some small enhancements. I can probably add an option to the playlist to show either the mixed tape or a cd or maybe just an album. Or maybe I could show do a thumbnail of the album art, if the reviewer had that. Then I guess there would be an option as to whether or not the page contained a mixed tape or single album.

Welp, guess I better add that to the “to do” list.

Apr 07

Patiently waiting

Arrghhh!!
So, I got approval and the “go ahead” e-mail for my Mixed Tape plugin. I did the checkout using TortoiseSVN and it created the folders for the plugin. But, after adding files to the trunk, creating a tag folder and committing the files back up to svn, nothing. The files are up on svn, but the download page has yet to update. The page still shows my login as the author and doesn’t have any of the other information that my WP People plugin download page has. Very frustrating.

I know I’m not the only one who has gotten frustrated with creating plugins. Just check out The Agony and Ecstasy – Creating a WordPress Plugin. I even found a guy who posted a video series called How to Host a Plugin on WordPress in a four part series. The only thing I learned from the series is that it would be nice to have a new computer and maybe I would use a free open source IDE called Aptana.

I think I’ll let it set for a day and hopefully it will magically fix itself. Until then, I manually reloaded the plugin so that the demo page would still work.

Apr 06

My new Mixed Tape plugin

Mixed Tape

Mixed Tape

I am about to release a new plugin for WordPress. I am calling it WordPress Mixed Tape (WP Mixed Tape). If you have no idea what a mixed tape (mix tape) is, well, take a little trip back in time with me. Back in the day (let’s say the 1980’s), [W:cassette tapes] where the way taking your music with you. The [W:8-track tape] had gone the way of the [W:Dodo] and record [W:albums] were not portable. If those terms seem foreign to you, I included Wikipedia links to help you understand a little better. The great thing about tapes were that you could copy them to another tape. And, if you didn’t particularly like all the songs on a tape, you could copy tracks or part of tracks off of one tape and put it on another. You could even put your own voice recording or other recordings on to the tape.

Of course, this lead to people making their own full tapes for different purposes. One of the best or worst purposes for mixed tapes was for wooing someone. If you had a crush on someone or had been dating them for a period of time, you could show your love by copying a bunch of different songs that related to your emotional attachment to the other person onto a mixed tape. You could also be creative and add your own commentary in between tracks to show how that particular song meant so much to you about the current situation. For better or for worse, mixed tapes either helped or hurt the lovelorn and their situation. In today’s digital age, mixed tapes are now replaced by CDs (if you are legally allowed to make them now). But, even CDs are going away, since people can download music directly. So, what is a person supposed to do now to make a mixed tape? Well, you write a blog post as a mixed tape.

You are probably wondering how I came up with this idea. Well, Dean Logic is always all over the place, but there was a focus for this.

I was reading a coupe of posts on Gizmodo about the Windows PC commercial where “Lauren” buys a laptop for under $1000 and keeps the change. The Apple Fan Boys on Gizmodo didn’t appreciate Lauren’s selection. Not really caring about what her selection was, I was thinking I could write her an open letter stating that I didn’t care what she bought, because she’s cute. Then I started thinking that it would be great it I could make the post into a Mixed Tape. And that’s how this came about.

Basically, you add tracks to your post as you write. The idea would be that the tracks correspond to that particular part of the post. And then you add a tag to add the play list to the post with the name of your mixed tape, because very good mixed tape has a label. The code goes through and converts the track and play list tags and presto! You have a post that is also a mixed tape.

Now, to work on my open letter/mixed tape post for Lauren.

Mar 24

In a cloud

While I was surfing around the WordPress plugins trying to work on updating my own WP People plugin, I spotted a really cool Flash plugin. It tags the Tags created using a post and puts them into a 3D cloud sphere. Tags basically help search engines and those using search engines find pages on specific topics. For example, I plan on tagging this post with “wordpress, cloud, WP Cumulus, plugins”. This means, that anyone searching on those four tags, should see this post as one of the search results.

Anyway, back to the plugin. I did a quick search and found Roy Tanck’s plugin called WP Cumulus. Nice name. Someone else had created a plugin called Flash Tag Cloud, but after just a glance I figured it wasn’t the same one I saw earlier. So, I did a little more research and figured out the correct one. It was easy to install and after a few tweaks, fits perfectly into my site. So, I gave Roy Tanck a donation of $10. Right after I gave him the donation, I noticed he had another cloud application that showed Flickr and Picasa RSS feeds. Now, this version isn’t exactly a plugin version, I guess he’s still working on the details. However, he did provide a way to add it to your site. So, I created my Picasa ablum cloud and with the help of the Text/HTML widget, stuck it into my site. Awesome! Nothing like letting someone else do the hard work. But, I did reward him.

I also decided to use FAQ-Tastic Lite as my FAQ tool for my Applications and Plugins. It seems to do everything I need. I also just gave him a donation, but the conversion rate made his a little higher. There does seem to be a lot of work done on the tool, so I don’t have too much of an issue with the donation I gave.

Mar 20

99.9999% done with WP People

Well, I figured out how not to only add buttons for my WP People plugin but to have it popup with a window to select from the WP People list and then select a person and have it insert back into the Page or Post. And, I got it to work with both the tinyMCE (the pretty WYSIWYG editor) and basic editors. Yippee!!! Of course, IE is a piece of junk, so it doesn’t work 100% with IE. A couple of errors appear when it loads the list popup, but you can just click through those and the insert still works.

On top of getting this to work, I reduce the number of pages used in another example I saw. In the other examples, it looked like they had to create one popup page for each of the editors. I managed to make it work with just one page (i.e. regardless of what IE says). I also eliminated some other side files that the examples were using. However, my plugin is much simpler and didn’t need a lot of other things.

Of course, as I sit here writing this, I realize that I didn’t restrict the WP People list to the owner, so I guess I’ll be making a quick change. A geek’s work is never done.

Mar 20

A little more functionality to WP People

After looking over a few examples of adding a button to the Post/Page editor, I found Deanna Schneider’s blog about adding a button. And, I got it to work! Woo hoo!

wp-people-ss-tinymce-toolbar

Through her example, I was able to figure out how to create a page that would be called when the button is clicked. The popup page lists the WP People available, with their picture, an abbreviated version of their bio, name and nickname. Next to each person is a button to insert them into the post. When you click the button, the full name of the person is inserted into the post. Simple as that.

Now, I just have to figure it out on the basic Page/Post editor. I figured out how to add the button.
wp-people-ss-simple-toolbar

However, I’ve only been able to pull up a separate window with the list in it. This really doesn’t work for what I want to do. I want to have the popup that allows me to interact with the page that pulled it up. I’m sure it’s something simple and hopefully I’ll figure it out soon and then I’ll be done with my WP People upgrade.