SDAC Blog

Check out our blog for WordPress updates, WordPress plugin reviews, and general web development hints.

hr
hr

If you ever need to exclude a single category from a WordPress page (archives, index, category page, etc) you can easily do so by using a little conditional tag code within the WordPress loop.

The example below will skip over any post that is in the category with the ID of 35:

PHP:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if (in_category('35')) continue; ?>
<?php the_content(); ?>
<?php endwhile;endif;?>

This can be helpful if you want to not show a particular category in your blog (if you have a category based site setup) - or if you want to hide some categories from your search results.

separate
hr
hr

I needed to be able filter out the text "Private:" for posts and pages that were password protected but did not want to edit any core WordPress files. To filter out that text, I added the following code into my functions.php file (within my theme directory):

PHP:
function remove_private_prefix($title) {
$title = str_replace(
'Private:',
'',
$title);
return $title;
}
add_filter('the_title','remove_private_prefix');

(I also posted this filter in the WordPress Support Forum)

separate
hr
hr

There is a new (relatively) caching plugin in town for WordPress called WP Super Cache and after using it now for a few version, I have to say I would recommend this over the old standard WP-Cache plugin. The plugin is easy to install, easy to configure, and will produce a noticeable load time decrease for your WordPress sites. There are also options to set if you want to "digg-proof" your site, use compression, or "lock down" your site during an expected traffic spike.

separate
hr
hr

There are several tidbits of code that I have collected over the past few years that make it easier and easier to turn a simple WordPress installation into a very functional content management system (CMS). There are many times when it would be nice to show logged in members certain bits of information (certain categories, posts, or just a simple "Welcome back!") and of course there is a simple way of doing this:

PHP:
<?php if (is_user_logged_in()): ?>

That bit of code will allow you to do something like this which will allow you to show the logged in user's preferred user name (selected in the User preferences), and then a list of member only pages (private page parent is page ID 20 - I am showing all sub pages of the members-only pages marked as private). If the user is not logged in, they will get a Welcome visitor! greeting :

PHP:
<?php if (is_user_logged_in()) : ?>
    <?php global $user_identity;get_currentuserinfo();?>
   
    <p>Welcome back <?php echo $user_identity;?></p>
    <p>Here is a list of private pages only viewable by Members:</p>
        <ul>
            <?php wp_list_pages('title_li=&child_of=20'); ?>
        </ul>
<?php else :?>
    Welcome, visitor!
<?php endif;?>

You can make it as simple as a change in greeting for members and non-members, or put in specific logic like I did with showing the pages. The potential is limitless.

separate
hr
hr

url: http://www.foursquaredev.net

Foursquare

SDAC Inc. provided:

  • Server Purchase/Setup/Configuration
  • XHTML/CSS programming
  • Custom PHP Form, Admin, and Scoring Admin
  • Multi-Language Form (Localization)

technologies used:

XHTML, CSS, PHP, HTML_QuickForm, jQuery", Smarty"

front end:

The client wanted a user interface that was easy to use and light weight since the users were mostly from foreign countries where internet connections were often hours away. I used minimal images, CSS, and javascript to ensure the application process (30 pages of text, radio button, and select fields, and long essays) would go as smoothly and quickly as possible why still providing feedback to the user if they missed a field or provided inappropriate data. The admin also had to be easy to use, as the Foursquare staff needed to easily access the data after the applications were submitted or if the submitter had any questions.

back end:

This form needed to be presented in English and Spanish so all text (labels, error messages, confirmation email, etc) was stored in both languages and then presented appropriately with custom logic. We used HTML_QuickForm and Smarty to build the form quickly and effectively and then used jQuery to handle custom validation rules given to us by the Foundation.

lessons learned/random thoughts:

This was by far the longest and most complex form I have ever worked on or seen. Adding in multiple languages this form was also very time consuming but a great experience. A special thanks to our talented developers on helping make this a success.

separate