Customizing WordPress RSS Feed- What Posts Display

The guys over at Katz, have created a perfect tutorial for creating your own RSS feed template for your theme. This will allow you to dig directly into your RSS code (for this custom file), and customize it as you please!

You can customize which posts show up in your RSS, by putting a WordPress Query right below the “do_action( ‘rss2_head’);”, and above the “while(…”.

Enjoy,
Ashton

 

 

 

WordPress Plugin Settings: Contact Form 7

I’ve used Contact Form 7 on a number of websites.

I dislike the default settings for the contact form because I like to realize when emails I get are from my website. (Also email providers like to see that the from address is actually from the same server where that domain is.) These settings also make it easier to reply to the website visitor.

Here’s what I change the Contact Form settings to:

From: contactform@website.com
Subject: Website Contact Request: [your-subject]
Additional Headers: Reply-To: [your-name] <[your-email]>

Enjoy,
Ashton Sanders

Websites in a Flash CSS Reset

As one does more and more work with CSS, you start to create a CSS Reset that work well for you and your workflow. There is some important code that I always recommend having on any website, so it’s more of “CSS Starter Code” that a “CSS Reset”


/* ~-~-~~-~ CSS Starter Code -~-~-~-~ *\
|                                      |
|           by Ashton Sanders          |
|                                      |
\* ~-~-~~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ */

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
vertical-align: top;
}

ol, ul {
list-style: none;
}

html { overflow-y: scroll;}

strong, b {font-weight:900;}
em { font-style:italic; }
big { font-size: 1.17em }
small, sub, sup { font-size: .83em }
p { margin:1.12em 0;}

I’ll probably update this more in the future.

Ashton

PHP Mail Fail on Windows IIS Server

Over the years I’ve transferred a number (too many) PHP websites to Windows servers running PHP (or have had to install PHP apps on a windows server, etc.). One of the biggest problems I always run into when using PHP on a Windows IIS Server is that the PHP Mail Function doesn’t work.

The solution is to change from using the PHP Mail Function to using Authenticated SMTP delivery. In essence, you’ll set up your web app to act like Outlook or Thunderbird to connect to an emailbox directly. This app obviously won’t download any emails; just send them.

You can search for “PHP SMTP email” to get some good solutions to how to handle this with a Pear script.

If you’re using WordPress, though there’s a very simple WordPress Plugin called WP-Mail-SMTP that does all the hard work for you. All you need to do is enter your server information and select your settings.

I just used it, and it took 5 minutes to setup and test.

Development Temporary Image Placeholder

I found this great website that helps you instantly create temporary image placeholders for your development websites. Here’s the default example of the temporary image:

Temporary image placeholder

I create this image by making the image source (src=) “http://dummyimage.com/480×108”.

The website automatically creates the temporary image with the number. Just looking at their home page, I found that you can also change the background color, text color and replace the dimensions with text. Here’s an example:

Temporary image placeholder

The source for this image is:

http://dummyimage.com/470×115/0F6983/fff&text=Temporary+Image+Text

I highly recommend checking out their website at: http://dummyimage.com/

Enjoy,
Ashton Sanders

Firefox Adding and Removing Scrollbar (CSS Fix)

In Firefox, if the webpage you are viewing is not taller than your screen (and doesn’t need a scrollbar), Firefox will completely remove the scroll bar from your screen. This adds 20px of more space to your view space. Unfortunately, if your website is centered, this will actually move your webpage 10px to the left or right when switching between some pages.

This CSS code will automatically force a sidebar onto every page of your website; even if the scrollbar is not needed. That will stop your webpage from moving left and right on different pages:

html { overflow-y: scroll;}

Enjoy,
Ashton Sanders

WordPress: Redirect Blog to First Post

I just created a simple WordPress installation. It was only going to be short pages and a simple shopping cart, but at the last minute, they decided to add a blog. Since the area for text was so small, we decided to only have one post for every page. As it would only act as duplicate content, there is no point in using the blog home page at all.

With some help from WP Recipes, I created this code to redirect the blog home template (home.php) to the first post:

<?php
/*
home.php (Blog Home Page):
Redirect To First Post
*/
if (have_posts()) {
while (have_posts()) {
the_post();
wp_redirect(get_permalink());
}
}
?>

It’s actually very simple. It just uses the WordPress Redirect function to redirect to the first permalink that would show up on that page.

Enjoy,
Ashton Sanders

(P.S. If you haven’t heard, Adobe just released the pre-order for CS5… If I were to get one of the packages today, I’d probably get: Adobe Web Premium CS5. It looks ridiculously epic.)

Free FLV Editor – Not Trial Software!

I have looked through the interwebs for many an FLV video editor. There are many to select from on CNET and for any search on Google. I have downloaded and tried many of these. Even with them being trial software, I was not impressed. In a sentence, I’ve had horrible luck trying to find a good FLV editor.

I’m not totally surprised since most people don’t do a lot of FLV editing. Most people who work with videos create and edit videos in another format (MPEG, AVI, etc.) and then use a FLV converter to turn the file into a Flash Video. If an edit needed to be done to the video, it would be done in the original format and re-exported into Flash Video.

This brings me to my point: I have found a pretty cool FLV editor that is not trial software. You can clip the timeline very easily and edit the MetaData for the Flash Videos that you edit. It is built in Adobe Air.

Here’s the link to the FLV editor build by RichApps.

Thanks!
Ashton Sanders

SQL – Delete Similar or Identical Records

Deleting similar or identical records in SQL is a lifesaver. I found Brian Cryer’s “SQL How To…” about deleting similar or identical records in SQL. It’s got a lot of information, including the code for MS-Access SQL.

Here’s a quick explanation of what the following code does:

It searches MyTable for and deletes all rows where the dupField is the same except for the row with the lowest uniqueField.

Delete Similar Records

To delete similar records, i.e. where the records are not the same but one field is the same and only one copy needs to be preserved, try the following SQL:

DELETE T1
FROMÂ MyTable T1, MyTable T2
WHEREÂ T1.dupField = T2.dupField
AND T1.uniqueField > T2.uniqueField

To break this down even further, this code would delete all rows in MyTable that had the same value in dupField.

DELETET1
FROM MyTable T1, MyTable T2
WHERE T1.dupField = T2.dupField

This last line restricts the deleting to only rows that are also greater than another row with the same dupField

AND T1.uniqueField > T2.uniqueField

Obviously, you would replace the field and table names to work for your table.

Talk soon,
Ashton Sanders

XO Hosting Review

I’ve been fortunate to work with John Klein and some of the ladies over at KMP Advertising to help them create their new website. They created a beautiful website that I was proud to develop for them.

I built the website with a simple php include template and basic htaccess rewrite for the client pages.

XO Hosting meets Ashton Sanders

We had been planning on switching hosting accounts to my server, but when XO Hosting (there previous hosting provider) promised that it would destroy the email setup, we decided to keep it there. No problem. How bad could it be? If nothing else I will get to write a lengthy XO Hosting Review…

Last night, I started transferring the new website files to the XO Hosting server. I went to test one of the simplest pages on the site, and got an error that said:Â “CGI Scripting not allowed on this server.” Well that stinks. I waited till this morning so I could contact their technical support.

Thankfully, turning CGI Scripting (and PHP) was easy enough to do. Unfortunately, I hadn’t even gotten started on the problems with XO Hosting.