Dynamic Title Tag

<title>
   <?php 
      if (function_exists('is_tag') && is_tag()) { 
         single_tag_title("Tag Archive for &quot;"); echo '&quot; - '; } 
      elseif (is_archive()) { 
         wp_title(''); echo ' Archive - '; } 
      elseif (is_search()) { 
         echo 'Search for &quot;'.wp_specialchars($s).'&quot; - '; } 
      elseif (!(is_404()) && (is_single()) 
Avatar of Chris Coyier
Chris Coyier on

Display Author Info

The image that shows for the author comes from the email address set for that user which goes to a corresponding Gravatar. The display name and bio come from the User settings area in the Admin.

<div class="author-box">
   <div 
Avatar of Chris Coyier
Chris Coyier on

#73: Building a Website (3 of 3): WordPress Theme

In part 3 of this series, we take the HTML and CSS that we have already created for this design, and convert it into a WordPress theme. We start with a completely “blank” WordPress theme, then take different parts of …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Select Element Only if Children are Not Animated

var myChildrenBehave =  $(".element").filter(function() {
  var filtered = $(this).children().not(":animated");
  return filtered;
 });

This selects the element only if its children behave (not being animated). Very helpful on a drop down menu (on hover or click)…

Avatar of Chris Coyier
Chris Coyier on (Updated on )

New Poll: When Do Jobs Get Done?

There is a new poll up in the sidebar. This time regarding when jobs that include completion dates actually get done.

There are reasons on both sides of the client/designer relationship that affect when jobs actually get done. How quick …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Use Firebug in Any Browser

Just include this script on the site and you’ll get a Firebug console that pops up for debugging in any browser. Not quite as full featured but it’s still pretty helpful! Remember to remove it when you are done.

<script 
Avatar of Chris Coyier
Chris Coyier on (Updated on )

Login Function

These functions will log in a user based on a username and password being matched in a MySQL database.

// function to escape data and strip tags
function safestrip($string){
       $string = strip_tags($string);
       $string = mysql_real_escape_string($string);
       return $string;
}

//function to 
Avatar of Chris Coyier
Chris Coyier on (Updated on )

Cleaning Variables

Variables that are submitted via web forms always need to be cleaned/sanitized before use in any way, to prevent against all kinds of different malicious intent.

Technique #1

function clean($value) {

       // If magic quotes not turned on add slashes.
       
Avatar of Chris Coyier
Chris Coyier on