WordPress Wednesdays: Where to Begin

A lot of people want a web site or a blog but do not know where to start or what all WordPress has to offer. If you are looking for a great, easy to use system to publish content on the web – I would start here:

  1. Start Free. If you want to simply check out WordPress and see what is made of – sign up for a free account at wordpress.com You can choose from several free themes (look and feel) and have no worries about backup, hosting, etc. This will allow you to focus on the content and not get frustrated with installation/set up and hosting.
  2. Read. Take 10 minutes and read through some of the documentation.
  3. Play Around. Familiarize yourself with WordPress widgets (sidebar) and start taking control of your content.
  4. Customize. Once you are ready to move your site to a host so you can customize your theme, your plugins, etc – start looking at some free plugins before doing any custom development. It is most likely you will be able to find something free that fits your needs.
  5. Add. Check out the themes and plugin listings on wordpres.org (Extend).
  6. Learn More. If you get to a point where you have a site up, you have content, and you want to find out more about what all WordPress can offer – I would suggest either buying a WordPress book or pay for an hour of consultation with a company that specializes in blog consultation (like my company) so you can really maximize your web site presence and efficiency.
  7. Small Steps. Most importantly – start small and build on it. Blogging and maintaining a web site is not always fun or easy – but taking small steps (one new plugin at a time, or a slight change in a template) will ensure your web site will continually develop into something great!

Just remember – you do not have to be a graphic designer or a programmer to have a great web site – you just need patience and a willingness to learn!

WordPress Wednesdays: It is All About the Query

My last ten or so projects I have been working on all have a common theme: maximize WordPress’s ability to be a powerful CMS. Clients more and more are coming to me with the need to create a custom fields which they can store/query data throughout their site.

WordPress is completely customizable and because of this – it is easy to add custom fields to any post or page and then use the data put in them throughout the page.

Example: You have all your clients listed on your web site – and have created profile pages for them. Not only do you want to show their profile – you would really like to have a page template that shows all your client logos – and does so dynamically so that anytime you add a new client – their logo gets added to the mix automatically. The examples are endless and the solution is easy.

Step 1: Create a custom fields plugin (or use the generic custom fields) – personally I like to create a plugin so that I can completely customize and make adding content as easy as possible. If there is interest – I can cover how to create a plugin.

Step 2: Now that your data is stored – you can use it anywhere you want (in the loop, outside the loop). You can use something like:

ID, $key, true);?>

to display the data. (see Using Custom Fields for more information).

Step 3: Again – now that the data is stored – you can also query it so if you wanted to show all logos (as mentioned above) – you can do so by using WordPress’ query_posts to query and then display the data. (see Query Posts for more information).

Stuck? Interested? Let me know.

PHP 4 or PHP 5? You Pick the Flavor

I recently ran into a situation where there were two versions of PHP on a server and I needed to make sure PHP 5 was being used. To pick the version – all you need to do is add the following into your .htaccess file (assuming you do not have access to your httpd config):

For PHP 5:
AddType application/x-httpd-php5 .php

For PHP 4:
AddType application/x-httpd-php4 .php

It does not get much more easier than that!

How to Find Geographical Coordinates

Ever need to find your location using latitude and longitude? Do a search for your destination using Google Maps and then when your destination is in the center of the map – type:

javascript:void(prompt('',gApplication.getMap().getCenter()));

into the browser address bar (no http or www) and your coordinates will appear.

Quick CSS for WordPress Images (Updated)

A week or so ago, I posted some information on how to quickly style your WordPress images. After recently updating my company’s web site (SDAC Inc. – I noticed if you used captions, my custom CSS would not work. Here is some CSS that will work with and without image captions:

.alignright, .aligncenter, .alignleft {padding:4px;background:#ecece2;border:1px solid #c7c7bb;}
.alignright {float:right;margin-left:5px;}
.alignleft, .alignnone {float:left;margin-right:5px;}
.aligncenter {display: block;margin-left: auto;margin-right: auto;}

The difference? I used img.align.. which worked if you did not use captions, but if you use caption, there is an outer div class called align… The more generic CSS posted here takes care of both issues.

Quick CSS for WordPress Images

If you install WordPress and use the media uploader to manage your images in your posts – you can easily style your images quickly by adding the following code to your theme’s stylesheet.

img.alignright, img.aligncenter, img.alignleft {padding:4px;background:#efefef;border-color: #aaa #ccc #ddd #bbb;border-style: solid;border-width: 1px;}
img.alignright {float:right;margin-left:5px;}
img.alignleft, img.alignnone {float:left;margin-right:5px;}
img.aligncenter {display: block;margin-left: auto;margin-right: auto;}

This code will set up your images to float appropriately, as well as give a nice border as seen below.

Christmas in DC

Note* This information is now updated: Updated CSS

Find and Replace With phpMyAdmin (or using SQL)

Ever need to find and replace something in your WordPress database? (perhaps you changed domain names and have the old domain name or folder structure hard coded into some of your posts) You can easily update your database by using phpMyAdmin or by using the following code in any SQL interface:

UPDATE wp_posts SET post_content = replace(post_content,"http://olddomain.com/blog","newdomain.com/"); 

The first part of the command says “update the database table wp_posts” (where your content is stored). The later part of the command says “use the field “post_content” (where all your actual post content is stored” and then find “http://olddomain.com/blog” and replace it with “http://newdomain.com”. You can find anything (not limited to domain name) and replace it with anything as well. This is a great time saver!

How to Get Stuff Done

The last few weeks I have been extremely busy and on top of that I have been dealing with a sick child and also being sick myself. There is no time to be wasted so efficient use of the time I had was crucial. I feel that since owning my own business, I have had to work very hard to make the most of my time and have a few tips:

  • Focus on 1-3 big tasks per day. Any more tasks than 3 will most likely cause you to spend too much time switching gears. I have begun making a list (yes – let the comments start pouring in as I was anti-list for a long time) of these items and then crossing each item off as I finish. This is surprisingly very rewarding.
  • Limit how often you check email. (See a post I wrote on this in the past)
  • Start the day with an easy task. It sometimes takes more time to get going mentally in the AM so starting with an easy task quickly builds confidence for other tasks later
  • Take time every hour to take a small break to keep your mind fresh
  • If you are having a problem with something you are working on – move on and come back to it later. Sometimes I can easily get lost in a problem and stop thinking about it rationally but by stepping away and coming back to it – I can often solve the problem quicker than if I would have stayed with it.
  • Set a stopping point or time and stick with it. Feel good knowing you have put in 6-8 hours of work a day and realize that there will be things to do tomorrow and not everything needs to get done today. By setting limits, you will feel much more refreshed the next day and your spouse/family will be happier as well.

Add a "Pseudo" Pseudo Class Hover in Inline CSS.

I have been busy this week with a few really cool projects – one of them to create a widget for any site that will show the latest news items from a RSS feed – while not limiting the widget to servers with PHP. After putting that together, I had to add inline CSS to style the feed output. Everything looked great but I could not figure out how to add a :hover to an inline style…until I realized I could fake it by adding some basic javascript: onmouseover and onmouseout to change the font color.

<a href="file.html">Title&lt;/a

repairing a mysql table

I have run into some database problems over the years, but had to do something different today when I saw that this site had a problematic table (wp_posts). When I looked at the issue first, I got the message “MySQL error code 145 = Table was marked as crashed and should be repaired”.

To repair a table, I have run (at a mysql prompt in the command line): REPAIR TABLE wp_posts; but today that did not work. After doing some research, I finally was able to fix the table by using: myisamchk -r wp_posts (see documentation. This was a lifesaver!