SDAC Blog

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

hr
hr

For a no-nonsense way to set the order of your Blogroll links within Wordpress, place a numeric value in either the description or notes field then set up the wp_list_bookmarks function to order by that value. Make sure numbers that are < 10 are put in as two digits (01, 02, 03). This is not ideal, but it is quick and easy...and it works.

Once you added in the links to the Blogroll admin, use the following function: wp_list_bookmarks to display your links on your site. The following example will list all links and order them by the value in the description field. The output will not have "blogroll" nor the link category headings. For more information, check out the wp_list_bookmarks documentation.

PHP:
<?php wp_list_bookmarks('title_li=&orderby=description&order=ASC&categorize=0'); ?>

separate
hr
hr

After updating XOOPS to 2.0.17 a few months back, I ran into a problem with certain users not able to see group specific blocks after updating. The users would authenticate, but then not see any content that was "member only". I was hopeful this would have been resolved with 2.0.18 but it still remains an issue. The problem:

The solution:
In your XOOPS directory: /kernel/session.php

change:
var $enableRegenerateId = true;
to:
var $enableRegenerateId = false;

(Original fix documentation for 2.0.17: http://www.xoops.org/modules/newbb/viewtopic.php?topic_id=62411&forum=2&post_id=281576

separate
hr
hr

If you use Google Analytics on your web site, you should update your tracker code that is placed in your code. The new tracker is faster, and offers added tracking functionality (See Google's announcement)

New Code: (put your tracker ID in where you see the X's)

HTML:
<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
<script type="text/javascript">
var pageTracker=_gat._getTracker('UA-XXXXXX-X');
pageTracker._initData();
pageTracker._trackPageview();
</script>

While you are updating your code, you might also want to consider moving this and any other javascript to the bottom of your web site for improved performance.

separate
hr
hr

If you would like to exclude one post from your blog, archive, search results or wherever you need to on your blog, you can do so by putting in a small piece of code within the particular WordPress loop:

The following example will show all posts except for the post with the ID of 179:

PHP:
<?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == '179' ) continue; ?>
<?php the_content();?>
<?php endwhile;endif;?>

This is something that I get a lot of requests for and is very useful in a number of situations.

separate
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