WordPress Tips

I’ve been working on WordPress sites a lot lately.  The other day, it was Charlene’s blog.  Today, it was the CCF Alumni Foundation website, of which I’m the Chairman.

Since the early days of the web, I’ve often used the JavaScript Enkoder form by Hivelogic to obfuscate my e-mail address in order to protect it from spammers.  The problem is that because it’s based on JavaScript, it’s not super-compatible with WordPress pages and posts.

Fortuitously, I ran across a PHP plugin version written specifically for WordPress.  It’s called PHPEnkoder.  So now, any plaintext e-mail addresses as well as any mailto: links on the website are now automatically encoded using the Javascript Enkoder.  Fantastic!

This is what my e-mail address looks like when it’s been “enkoded.”


<script type="text/javascript">
//<![CDATA[
<!--
var x="function f(x){var i,o=\"\",l=x.length;for(i=0;i<l;i+=2) {if(i+1<l)o+=" +
"x.charAt(i+1);try{o+=x.charAt(i);}catch(e){}}return o;}f(\"ufcnitnof x({)av" +
" r,i=o\\\"\\\"o,=l.xelgnhtl,o=;lhwli(e.xhcraoCedtAl(1/)3=!97{)rt{y+xx=l;=+;" +
"lc}tahce({)}}of(r=i-l;1>i0=i;--{)+ox=c.ahAr(t)i};erutnro s.buts(r,0lo;)f}\\" +
"\"(5),5\\\"\\\\{w`qyjj'.x\\\\-\\\\\\\"n\\\\ZZOT\\\\\\\\\\\\\\\\VTwOTXA]7P01" +
"\\\\\\\\22\\\\0s\\\\14\\\\0q\\\\21\\\\0N\\\\]FSA06\\\\07\\\\00\\\\\\\\77\\\\"+
"1L\\\\~p|5|sv`baI|disj34\\\\0F\\\\25\\\\04\\\\01\\\\\\\\32\\\\05\\\\03\\\\\\"+
"\\23\\\\05\\\\03\\\\\\\\0L6W01\\\\\\\\03\\\\06\\\\02\\\\\\\\\\\\n@\\\\`?px8" +
"8$7>'f=*2-'_K\\\\U\\\\\\\\\\\\\\\\(\\\"}fo;n uret}r);+)y+^(i)t(eAodrCha.c(x" +
"deCoarChomfrg.intr=So+7;12%=;y++)y55i<f({i+)i+l;i<0;i=r(foh;gten.l=x,l\\\"\\"+
"\\\\\"\\\\o=i,r va){,y(x fontincfu)\\\"\")"                                  ;
while(x=eval(x));
//-->
//]]>
</script>

The other problem I solved this afternoon was the implementation of a prayer requests form for the CCFAF.  It’s built on Google Docs technology, which I then embedded using an <iframe> into the WordPress post.  The problem wasn’t creating the form, that’s easy enough.  The problem was figuring out how to get notified each time the form was filled out.  But I ran across this article, and now we should be good to go.

Go try it out!  When someone fills out the form, I automatically get an e-mail notification.  Then I can either pray for it directly, or have someone from the Board pray for them.  Excellent!  Technology at its finest: serving the Kingdom of God.

WordPress Comments Administration

The other day I was going through some comments on Charlene’s blog, and it was frankly frustrating that I could only see 20 at a time, which is the WordPress default. I should be able to to change the number of comments per page in the admin interface via an easily accessible setting.

I wanted to be able to see 100 or 1,000 comments at a time.  So I went searching around for a solution.  The first solution that came up seemed about right (yay for Google!):

The page described a method of editing the code on the edit-comments.php file.  I’m very capable of editing php files, so that wasn’t the issue.  My issue was that there had to be an easier way.  I don’t want to have to edit a php page every time I want to change the number of comments. Additionally, the post was written for WordPress 2.7, and Charlene’s blog is already on 3.x

The next few Google results were either support tickets, or WordPress plug-in pages.  “I shouldn’t have to install a plugin for this!” I thought to myself.

Then, wayyy down on the 2nd or 3rd page of search results I found what I was looking for: “Change Admin Pagination on Posts, Pages and Comments“.  It alerted me to the fact that since WP 2.8, there has been a Screen Options button that looks like this:

Clicking that, in turn shows this:

As it turns out, I’m able to increase the 20 to 100, or 1,000 or whatever.

So now you know, you don’t need a plug-in, and you certainly don’t need to edit code.  If you’ve got the latest version of WordPress, you’re good to go.

I don’t post enough

As with many personal bloggers, I struggle to post on a regular basis.

I’m not making any promises, but I’m gonna try to post more often. There’s so much going on, I think a lot of it deserves some attention.  I was looking back over my posting history, and realize that I used to post some really interesting (to me at least) stuff on a fairly regular basis.  My goal is to get back to that.

A quick glance on the right side with my Archives shows that I was able to do at least one post every month from February 2008-May  2010. What happened in May? Not really sure, but I did start work at DayNine in April 2010, and that may have led to a higher level of busy-ness, which in turn led to a lower level of posting.

In any case, we’ll see what happens. But here goes nothing…

Removing Borders from Smileys

As I mentioned a few months ago, I updated my website to a new theme. An unfortunate consequence of doing that was that it put these ugly borders around all my smilies:

smiley1 smiley2

Frankly, it made them look like they were in prison. What to do? Take a dive into the code of course!

This was actually made easier by a nifty little utility called Firebug. It’s billed as a tool for web development, so in this instance, it definitely served it’s purpose.

I right-clicked on a smiley chose “Inspect Element” from the menu, and that brought up a window that showed me that the style of this image was dictated by the style.css file, and the img selector. It had a border of 1 pixel all around:

img {
border:1px solid #000000;
}

Firebug also showed me the code that was used to display the smiley:

<img class="wp-smiley" alt=":-)" src=.../>

Ah ha! They’re all tagged with the CSS class “wp-smiley”. That’s great because it means I could customize the CSS to remove the border.

So I hopped into the style.css file and added a new bit of code:

img.wp-smiley{
border:0px;
}

That means that for each img tag with the wp-smiley class, the border should be zero pixels.

And there you have it. Smiley’s without borders! 🙂 Happy coding!