wordpress posts page 3

Working on a new WordPress bare theme

I haven’t been doing much with WordPress, since at Cogneato we have our own CMS. But a customer request for a WordPress site a while back and the upcoming GiveCamp which I will be participating in this weekend have rejuvenated my interest in working with it. Back when I was using WordPress more often, I had built a bare theme I used as a starting point, including for the Stearns Homestead site I was working on when I first started this blog. That was the WordPress 2.x era though, and the theme is now outdated. I decided to begin work on a new theme, making use of the new 3.x features.

I have learned a lot since building that theme, and wanted to bring in some of my new knowledge and coding practices to the new theme. I also wanted to put this one on GitHub, since I now have an account and others might find it useful. I still haven’t decided for sure what I’ll call it (for now it is TJMBare) and have more work to do, so it isn’t on there yet, but hopefully will be by this weekend. Anyway, I wanted to mention some of the things I have done or will be doing with it.

Class helpers

I am putting all of my functionality and data into classes that in most themes is put into the global namespace. The classes will help group functionality and data together, making it easier to develop and to avoid collisions. Since WordPress doesn’t yet require PHP 5.3+, I am avoiding using PHP namespaces, but am compensating by putting the equivalent on the front of the class names. Functions.php will just include the class files and instantiate what is needed. Child themes will be able to extend parent theme classes to change functionality.

Continue reading post "Working on a new WordPress bare theme"

Givecamp 2011

Last weekend I went to GiveCamp in Cleveland. GiveCamp is a weekend of developers and designers building sites and applications for various charities. There were like 202 people there, working in the Lean Dog boat and in the hallway of Burke Lakefront Airport. There were 22 charities, each assigned a team appropriate to their needs. 21 of the projects were completed or nearly so in the one weekend allotted.

My project was Cleveland Carousel. My team also included a designer named Greg and another developer named Jon Knapp, who kind of managed the project most of the time. We had continuous help from at least one of the Cleveland Carousel people at all times. We also had a couple dedicated project managers come help us out for a little while as well.

The clients had a simple WordPress site in running with four pages, but they want something with a lot more content and pictures and a custom design. They came well prepared with a detailed plan of what they wanted, allowing us to move quickly with our small team. They worked with Greg to come up with a design, worked to put all of the content in place, and gave us continuous feedback as we built the site.

Continue reading post "Givecamp 2011"

WordPress: Determining Sections

There are many issues encountered when using WordPress as a CMS. One thing that is common on regular websites is the concept of sections. Different sections might have different highlighted or open menu items, sidebar content, layouts, or actions from the same widgets (search this section for instance). WordPress offers the ability to use different template files depending on the category of posts or what is selected for a page. This is somewhat limited though, as sites might have multiple pages and categories in a section. WordPress also has various functions that can be used in “if” statements to determine if the current page/post matches certain criteria. These can be logically connected in “if” statements to determine if “the_post” is in a section and placed anywhere in template files, but this requires repeating the same logic questions in every place you must determine the section, and would thus be a pain to maintain.

To keep these “if” questions in one place, I built myself a function to store them in, allowing me to ask if a page is in a section using only a name.

Continue reading post "WordPress: Determining Sections"

WordPress: My First Plugin

I made my first WordPress plugin today. It’s very simple and for my own site only: It adds the script bits for the Piwik analytics of my personal blog. It showed me just how easy it is to create a plugin in WordPress. Normally, for clients, I’d just add additional functionality in the “functions.php” file, but for my personal site I’m using the new default theme for WordPress 3.0 (in part out of laziness and in part to try out some of the new features it introduced). I decided rather than modify the theme at all I’d create a plugin, and was happy with how easily and well it worked.

Creating a simple plugin involves creating a PHP file in the ‘plugins’ folder (in ‘wp-content’). It can be named anything, and could also go inside of a folder if multiple files are needed. The plugin file starts with a snippet like the following:

Continue reading post "WordPress: My First Plugin"

Haley Litzinger: New Site for an Old Friend

It just so happens that Christian Bryant, a previously former friend of mine from my Winking Lizard days, lives almost right across the street from my new place of employment at Cogneato. And it also just so happens that his girlfriend is another previously former friend of mine named Haley Litzinger. She went to school with me in my Woodridge days, was in my class, and we were two of the three percussionists from our class in the school band. We also had seen each other a bit in college at Kent and then on very rare occasions after that. I saw Haley drive by after work one day, found her email address on her website, and emailed her.

Haley is trying to make a career as an artist, a notoriously difficult task. She does these very interesting paintings that are composed of multiple layers by painting on and combining layers of a transparent substance resembling glass. They are very interesting to look at, and she has sold quite a few over the years, but not enough to make a living or a name for herself. She built a website (the one I found) to more easily show her work to clients or galleries. She’s no web guru, so the site currently looks sub-par, unpolished, and is missing a lot of content. It also has a splash page and second home page that takes forever to load and site navigation only on the home page.

So I offered to help her fix up the site. After talking about the project, I will be creating a new site for her from scratch. It will be a very simple site, so it will probably not take long at all. Even though it will only have four basic pages/sections, the gallery section will have a lot of individual images, each with their own page. I decided to use WordPress because of the images, giving me a fairly powerful image management admin section without much effort. To make it more interesting for myself, I decided to delve a bit deeper into HTML 5 for the site. I will likely post about this soon.

I hope that I can provide her a better and more successful site. She wants it to be very simple design-wise, but I hope I can give it enough substance to give it a more clean and professional look.


WordPress: Shortcodes

I’ve been playing with shortcodes in WordPress. They provide a nice way to allow the client to insert certain content without them needing to even deal with HTML, such as predefined pieces or wrappers with specific classes or structure. They are the only way to effectively run PHP functions from within a page without actually allowing PHP code to be run. This can allow pulling things from data, such as custom fields or from Pods CMS. The built in shortcode, for instance, pulls image data from the database about images connected to a post.

It’s very easy to add a shortcode. You create a function that does what you want and returns a string to output in place of the shortcode then use the add_shortcode() function of WordPress to attach it as a shortcode. The function is done like:

function repFunctionName($repArguments, $repContent=null){
    return "some string";
}

$repArgument is an array of arguments passed to the shortcode like:

[repShortcode repArgument1="value1" repArgument2="value2"]
Continue reading post "WordPress: Shortcodes"

WordPress: Comment Approval Email Address

[Update 6/11/2009] See comments for resolution of this issue.[/update]

Had a weird problem that might point to a weird semi-bug of WordPress.

I just recently received an email asking me to approve a comment on the Stearns site. I haven’t touched the admin part of the site in two months. We had set them up to need to approve every comment, and to have WordPress email the administrator whenever a comment was submitted. When I left I had made sure the address in the >Settings>General pane was set to one of the Stearns people, and it still is. This is the address I thought would receive the comment approval mailings.

I went looking for information on where the address for comment approval mailings is pulled from. According to this thread, the mailings are sent to the address of the “admin” account. I had deleted the “admin” account for security purposes (getting rid of a known user name) and may have transferred that account’s posts to mine. Or maybe it’s because my ID is the next closest to zero. So my account may be considered the “admin” account now.

The other possibility that I thought of is that the mailings get sent to the post author. I’m set as the author of the post the test comment was set to and a number of others. I would have to change them all over to one of the Stearns people if this were the case.

Choosing the easier solution first, I changed the email address of my account to that of one of the Stearns people (modified with the “+” syntax to avoid duplication). I did a test comment on the same post as the previous one was sent to and did not receive an email, so the suspicion of that thread may be correct (have to verify with the Stearns people).

I think that is a silly place to pull the address from if true. It would certainly make sense to have this settable and not tied to one particular account. The comment moderator might not necessarily be the “admin” user, as with Stearns. It doesn’t seem to be unreasonable to have the comment approval mailings sent to the same person who receives mailings about user registrations (the one on the “General” tab). Or, to be a bit more fancy, either have a separate address or user set for comment moderation on the >Settings>Discussions pane.

I’ll update this post if I find out more.

[Update: 6/10/2010] At this point I am thinking that the author of the post receives the comment approval emails, as it would certainly make the most sense. For the Samba Soccer Club site I did a while back, I received a comment approval message for a post I wrote as myself rather than admin. I do have the lowest current ID, so that can’t be ruled out, but it really doesn’t make any sense for that to be how it works. I’ve realized that my changes on Stearns shouldn’t tell anything, because the lowest user id and post author are both the same for the relevant posts.[/update]


Canine: WordPress Custom Searches

The WordPress search by default looks through the title and content of all available posts and pages for given query words. But sometimes you might want to only search a certain category or search custom fields or some other criteria. On the Canine Lifeline site, we have a dog section where we want to be able to list dogs based on a number of parameters, such as age, gender, adoption status, et cetera. We are currently storing dogs as posts in a particular category, and using Magic Fields to add custom fields for various aspects of each dog.

WordPress sends search queries as GET requests from its search form. The “s” variable contains the search query, but others are allowed. In fact, if you’re familiar with the “query_posts” function, many of the parameters for that are available, and the rest can be enabled, because the search is basically just a regular WordPress query with parameters appended from the GET variables.

Continue reading post "Canine: WordPress Custom Searches"

Samba: Another Freelance Project

Yay! I’ve got another freelance project now, and this one I’ll actually get paid for. It won’t be much pay, I gave them a very low price, but it sounds like I will get paid more from this job in the future: They want me to be their go-to guy for updating the site and new features. They will probably have me do things like update dates and add images, so it may be like an hour a month or something, not a lot, but something.

So finally, the project is for Samba Soccer Club, a small Cleveland youth soccer club. I got the lead from Ronda Leffel, the coordinator of the eBusiness program I was in at Tri-C. I met with them Saturday at Baker’s Square to talk the project over.

They had a site at one point, but let that lapse, and now want a completely new site, from scratch. They still have the URL, so they will just have to get a host and transfer it, or however that works (I’ve never done it yet). I’m going to have to do a bit of research on hosts for them, but I might suggest they just let me manage their site on my hosting account. I’ve not done this before, but it sounds like Dreamhost‘s version of reselling is just letting us create users for our clients and bill them ourselves. They shouldn’t have too much traffic, so this should work fine.

Continue reading post "Samba: Another Freelance Project"

WordPress.com: Webmaster Tools and Site Explorer

I’ve been using Google’s Webmaster Tools and more recently Yahoo’s Site Explorer for my other sites.  They allow me to see crawl errors, keywords and some query ranking info, crawl statistics, and some other search engine related info as well as set some settings for how these engines handle my sites.

Because of the way these sites validate ownership of submitted sites (an uploaded file or a meta tag), I didn’t think I’d be able to use them with WordPress.com.  However, with a little searching, I found this page, which says how to do it.  In fact, had I payed more attention when exploring the admin section of my account, I might have noticed that the capability is built into the “Tools” page.

You just submit the URL like for other sites, then choose to validate with the meta tag.  Copy the meta tag and paste it into a specified field in that “Tools” page.  “Save Changes” and then press the validate button on Google or Yahoo.

This worked instantly on Google.  For some reason, Yahoo is just saying “Failed”.  Since it says it may take 24 hours to validate, I guess I’ll have to wait.  You’d figure a message other than failed would be used to say that it hasn’t been validated yet, but I’ve looked at the source of the page and verified the meta tag was there.

[Update 1/24/10] Finally Yahoo has validated by retrying. I had done this a few times spaced out after the initial setup, but it had just failed. I’m not sure why it finally worked. [update]