pictures

Quick CSS for WordPress Images

hr
hr Heading 2 Icon 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.

CSS:
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.

Note* This information is now updated: Updated CSS

Find and Replace With phpMyAdmin (or using SQL)

hr
hr Heading 2 Icon 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:

SQL:
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!

Undelete Something With SVN

hr
hr Heading 2 Icon Undelete Something With SVN

Ever delete something with svn (svn del) and then realize you needed it again? You can get it back by using: svn copy -r HEAD filenameyoudeleted.extension filenameyoudeleted.extension

svn copy is the command to get a working copy back
-r is short for revision. I used HEAD which will give you the latest in repository. You can specify a revision number, revision right before you committed, etc (check out svn help copy)
filename is what you deleted, then where it goes. I usually do something like this within the folder the file was located so you do not see any paths, but if your file was in /www/files/ you would need to specify the file path to /www/files/filnameyoudeleted.extension /www/files/filnameyoudeleted.extension

Working with SVN is a lifesaver - and this tip is gold.

Switch Repositories (SVN)

hr
hr Heading 2 Icon Switch Repositories (SVN)

In order to take a look at WordPress 2.5 before it was released, I used subversion to check out the latest code available using the instructions given on the WordPress site. Once WordPress 2.5 was released, I wanted to keep my sites using 2.5 and not the bleeding edge releases (2.6) so I needed to easily switch repositories from http://svn.automattic.com/wordpress/trunk/ to http://svn.automattic.com/wordpress/branches/2.5/.
I had never had to switch repositories, so it took some reading to figure it out. For future reference, the following command works when used in the directory you have the checked out files in: "svn switch http://newrepos.com ." For my example, I ran the command: "svn switch http://svn.automattic.com/wordpress/branches/2.5/ ."

How to Get Stuff Done

hr
hr Heading 2 Icon 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 ... [more]

Quick Site Backup (files and database) Via the Command Line

hr
hr Heading 2 Icon Quick Site Backup (files and database) Via the Command Line

If you do any sort of web development, it is more than likely that CPANEL and phpMyAdmin are good friends of yours...and you depend on them. Even though those are extremely handy to create/modify databases and create backups, it is extremely helpful to know how to do the same thing by using only SSH and command line utilities.

To backup (export) a database using the command line interface (CLI):

CODE:
mysqldump -p --user=username --add-drop-table database> backup.sql

You will then need to provide your database password and the exported data will go into a file called "backup.sql" which is located in the directory that you are currently in. (more mysqldump documentation

To backup your files:

CODE:
tar -cvzf backup.tgz directoryname

The command will create an archive of all your files so you can easily move or store one file (the archive). More tar documentation.

Add a “Pseudo” Pseudo Class Hover in Inline CSS.

hr
hr Heading 2 Icon 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.

[html]
Title


search

subscription information

Blog RSS

Comments RSS



Powered by FeedBlitz

blog categories

blog tags

most popular posts

  1. jappler recommends: room & board (store).
  2. using parallels and windows for web development debugging.
  3. another good first tuesday in november.
  4. remove all .svn directories in a directory.
  5. wordpress newsletter plugin.
  6. Add a "Pseudo" Pseudo Class Hover in Inline CSS.
  7. php live training.
  8. so long, farewell ben!
  9. css containers: one image, fixed width, rounded corners.
  10. feel better soon joe paterno.

blog archive

standards

Get Firefox!
XHTML
CSS