Blog

Read our latest blog posts, learn something new, find answers, and stay up to date.

SDAC Recommends: WordPress Plugin: WP Codeshield

So many of my clients love WordPress but hate the WYSIWYG editor.
The problem:
When users try to add content with HTML within the content – then go back to edit it, save it, and their custom HTML becomes a mess. For most – simply disabling the rich text editor (Users > User > uncheck “Use the visual editor when writing”) is good, but others like to use the editor except for a handful of posts or pages.

The solution:
Download and install WP Codeshield. This plugin will make sure that the rich text editor does not touch any custom HTML code within . All you need to do is wrap around your custom code and you can forget about any more issues with the rich text editor and any HTML you put in/edit.

*Note – if you put this in place and your outputted HTML text looks different than everything else (it is using a monospace font by default) – add : code {font-family:inherit} to your style sheet and the text will not look out of place.

New Condition Tag: is_front_page() (WordPress 2.5)

Great news for WordPress theme developers. WordPress 2.5 now offers a new conditional tag: is_front_page(). We have long lived with other options (is_page(‘home’)) or other logic like that, but the is_front_page() simplifies defining the “home page” in our templates. Thanks guys!

WordPress 2.5 Beta 1 Initial Opinions

I took some time today to download the latest version of WordPress (2.5 beta 1) and decided this would be a perfect opportunity to switch to using subversion to manage my WordPress updates. Now that I am all switched over – updates will be much easier to manage.

My initial thoughts and opinions on WordPress 2.5:

  • The upgrade was painless – 5 minutes.
  • All my plugins worked except for my “Secure Admin” plugin – but that was out of date.
  • My theme works fine – after I made some adjustments to some of my AJAX features that relied on an outdated version of Prototype.
  • The new admin interface is well laid out for the most part. I am still not sure I am sold on the really light colors, but I will give it some time to grow on me.
  • The admin interface is cleaner – it no longer shows artifacts like post and category ID which only a few of us use. (If you want to see the post ID or cat ID, just hover over the edit link next to these items and you can see it in the URL – thanks Demitrious)
  • The post interface is much elongated due to the options that were once available in the right hand column (categories, password protect post, etc) are now below the post box instead of next to it. This is going to take some time to get used to.
  • Overall – this is a big release and I look forward to working with the changes and enhancements.

Order Blogroll Links Easily Without a Plugin

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.


XOOPS Login Issue: 2.0.17 and 2.0.18

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

Upgrade Google Analytic Tracker Code

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)



var pageTracker=_gat._getTracker('UA-XXXXXX-X');
pageTracker._initData();
pageTracker._trackPageview();

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.

Exclude Single Post in WordPress

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 if ( $post->ID == '179' ) continue;?>

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

Exclude Single Category in WordPress

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:





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.

Remove “Private:” From WordPress Titles

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):

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)