WordPress Wednesdays: All Posts in a Parent Category

The need to show all posts in a particular category or that category’s sub categories is very high. There are not too many projects out there that do not require a customized search, a menu, or a listing of some sort where the user wants to include all posts (or exclude) that belong to a parent category. Until recently – there was no real good way to do this. You either had to hard code category names or IDs in an array, or get really creative.

I recently started using the following function mentioned in the WordPress Codex that made this very easy: post_is_in_descendant_category().

By using that function – you can test to see if a post is in a particular category or even several subcategories deep of that category and then use that to easily show exactly what you want.

Examples and documentation for post_is_in_descendant_category: http://codex.wordpress.org/Template_Tags/in_category

HOWTO: Use RapidSVN for SVN

If you are a web or application developer, there will come a time (hopefully) that you will need to use subversion for your projects. While I use the command line for this – there are some GUI applications that make it easy for people to manage their files using subversion. For this documentation, I have chosen to write about RapidSVN because it runs on both Mac and PC.

ONE TIME PROCESS

  1. Download the RapidSVN you will use to check in and check out files at: http://www.rapidsvn.org/download/release/0.9.6/. For Mac users – download the .dmg gile. For PC users, download the .exe file
  2. Install the applications on your computer.
  3. Check out the files that you want to edit. Go to the “Repository” menu and select “checkout”.
    • Enter in the URL of the repository where the files are currently located. (http://www.example.com/svn/yourfiles)
    • Choose where you want these files on your to be downloaded to on your computer (destination directory)
    • Use the latest revision (unless you have a reason to choose something else)
    • Do not worry about “Peg Revision” – Click the “Ok” button
  4. You will be prompted for a user name and password – those are for the repository. Enter in the information and your files will then be downloaded to your computer.

AFTER YOU HAVE INITIALLY CHECKED OUT THE FILES AND ARE READY TO MODIFY THEM

  1. Make changes to the existing files as needed. Once you are done, click on the icon for “Commit Change”. (Look for the up orange arrow).
  2. Enter in some documentation of the change. (Ex: I changed the CSS so that the navigation now works in IE 6)
  3. Click the “OK” button and your changes are now made to the files in the repository.

ADD NEW FILES

  1. Add the new files/folders to your local (on your desktop) copy of the files.
  2. Within RapidSVN – Click on the bookmark you want to work with on the left side of the window. On the right side – the files for that bookmarked repository will appear. You will see all your files – old and new.
    • Highlight the new files you added and click on the “Add Selected” button.
    • You will be prompted for a comment (explanation). (Ex. Added new graphic files for the header)
    • Check those new files in by clicking on the “Commit Change” button. Add another comment. (Ex. Checking in the new graphic files).

DELETE EXISTING FILES
*** Regardless of what happens – DO NOT DELETE CHECKED IN FILES USING YOUR OPERATING SYSTEM’ DELETE OPTIONS (move to trash, etc). If you want to delete a file from the repository – you must use SVN. If you delete the files with your OS – you will get errors which will stop all future edits until it is remedied. You might see a folder with a name of “.” do not worry about it, remove it, or try to delete it.
*** You can only delete files that have already been checked in. If you add files, do not check them in, and want to delete them – you can use the OS to delete the files.

  1. Within RapidSVN – Click on the bookmark you want to work with on the left side of the window. On the right side – the files for that bookmarked repository will appear.
  2. Highlight the file you want to delete and click on the “Delete Selected” icon. The file will still be listed until you check in your changes.
  3. Check in your changes by clicking on the “Commit Change” button. Add a comment. (Ex. Removed old logo file). 4. The list of files will now be updated.

Show One Post/Page in WordPress

If you want to have a content area somewhere on your site that shows content from a post or page – and you want to do this with using the simplest of code (no loop, no query_posts, etc), check out the function get_post. The get_post function allows you to simply get one post’s title, content, category, etc by simply adding a few lines (see the example in the documentation) of code to your site. I have used this on a number of client’s sites as well as recently on my company site for the company profile. Keep it simple!

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

Multiple IPs, One NIC, Apache, Multiple Virtual Hosts with SSL, Mac OS X

Set Up: Mac OS X Client OS, one network card, and multiple Virtual Hosts (three of the Virtual Hosts need SSL certificates) using Apache. Continue reading Multiple IPs, One NIC, Apache, Multiple Virtual Hosts with SSL, Mac OS X