Modifying CSS in the LightWord theme for WordPress

The theme that I am currently using on my website, LightWord, is generally very nice and I love it.  However, there are a few issues with it, luckily, LightWord offers a nice way to correct some of the formatting issues without actually having to update the theme itself through the LightWord Settings page.

To access the LightWord Settings page, go to the Appearance -> LightWord Settings choice on the left side menu in the WordPress admin dashboard.

In this page, scroll down to the Custom CSS settings text box.  At this text box you can enter any additional CSS and it will be inserted into every page on your blog.  I’ve used this to fix a few issues that I have with LightWord.  First, I wanted my blog title to appear in a different color.  I changed this, with the following bit of CSS:

h1#logo,h1#logo a{color:#FF6600;}

Secondly, I wanted a different background; which was solved with this snippet:

body {background:url(‘wp-content/themes/k3290370.jpg’) repeat;}

Lastly, the drop down menu background was too small for some of the titles it was displaying so it would cause them to overflow.  I did a quick change that expanded the size of the menu drop down background, like this:

#front_menu ul {width:300px;}

Of course, you can override all the CSS you want within this text box, so if you wanted to change the color of links or whatever, you can do it right here without modifying the actual LightWord theme.  In addition to the Custom CSS, the settings page also allows you to add in additional scripts, headers, and footers.

Integrating Twitter into the sidebar

If you look to the right sidebar on the site you’ll notice that I now have a ‘What I’m Thinking…’ section.  Yes, your eyes are not deceiving you, I’ve modified the site again, this time integrating Twitter messages into the blog.  I used Twitter for WordPress, a very lightweight plugin that can be used either as a widget or a simple php command.  I used it as a php command and let the theme style the list for me.  Overall it took me a few minutes of coding to make it look like I wanted and only required the following modifications to the sidebar.php part of the theme:

<h3><?php _e(‘What I\’m thinking right now…’,’lightword’); ?></h3>
<?php twitter_messages(‘my user name’,2,true,true,'<br>’,true, false, false); ?>

The _e method is part of the theme’s translation code so I actually don’t need to use that at all, but I did to stay consistent with the rest of the page.  The meat of the code is the twitter_message function.  It takes a few parameters:

  • The user name to read the tweets
  • How many tweets to fetch (maximum of 20)
  • Show as a list (true or false)
  • Show a relative time stamp (true or false)
  • link options (I just used <br>)
  • Show hyperlinks as clickable URLs (true or false)
  • Show twitter usernames as clickable links (true or false)
  • Encode UTF8 (true or false)

If you want to learn more about the parameters of Twitter for WordPress you can visit the author’s home page for the syntax and more examples on how to use it.

Awesome Blog Spam Comments

As everyone with WordPress knows, Akismet is the best plugin for it.  Akismet catches all of the probable spam comments and holds them in a queue until they are approved.  Originally I noticed all of the blog spam comments I received were complete gibberish and contained links to who-knows-where.  Lately, their messages have begun to get more interesting.  For instance, take a look at these comments:

  • In truth, immediately i didn’t understand the essence. But after re-reading all at once became clear.
  • How much money does the government take out of online contest prize money?
  • How much money does the Treasury typically print?
  • Really enjoyed this! Well done!
  • How can i use money on my paypal balance instead of using money out of my bank account?

All these comments could work had they not been found connected to a post that had nothing to do with online contests, the Treasury and PayPal.  The other two, just didn’t make sense within the context of the post either.  Nothing I’ve written about Mount Bonnell was particularly deep and therefore, no real essence.  Had I seen this posted under a post detailing some interesting subject, I’d almost let it go (but then you’d see who it was from and that would tell you right away it was spam).

Anyway, with these comments becoming more and more probable as true comments to your article how do you think the spam filters are going to work?  I could see them integrating a reasoning-type procedure that does some analysis of the original post versus the content of the spam comment a decision could be made based upon some relevance calculation.  I suppose the other thing to do would be to force all commentators to register for your website and then the admin can accept / ban / remove the users as they see fit.  However, it doesn’t mean that a spam bot still couldn’t get through — it just might take longer for them to be accepted.  Unfortunately, I just don’t see a failproof way to remove all spam comments from a blog without some sort of human interaction.   I’m sure we can come very, very close, but the last 5 to 10% of the spam is probably going to need to be determined by an intelligent human.

Website Updates

I decided to make a few changes to the webpage since I had some spare time this morning thanks to having to change out an OmniPod pack.  The first item I added was a rotating tagline widget.  The widget can do much more than that, but I only wanted it to change the tag line at this time.  The second was to remove the list of archive months and replace it with a drop down select box.

The quotes widget was called ‘Stray Random Quotes’ which can be downloaded by your WordPress installation from the Plug-ins section.  Setting it up to replace the tagline with a random quote was very simple.  You just have to find the following line in your WordPress theme files

<?php bloginfo(‘description’); ?>

and replace it with this:

<?php if (function_exists(‘stray_random_quote’)) stray_random_quote(‘tagline’,false,”,false,1,0,’quoteID’,’ASC’, false, ”); ?>

where ‘tagline’ is the category to pull the quote from in the internal db table.  You could use ‘all’ and it would pull a random quote from the table.

The second change, converting the list of archived months to a drop down was a little more involved since it required doing some CSS styling as well as some JavaScripting.  The code to handle the drop down is actaully in the WordPress Codex somewhere, but here is the code I used:

<select name=”archive-dropdown” onChange=’document.location.href=this.options[this.selectedIndex].value;’>
<option value=””><?php echo attribute_escape(__(‘Select Month’)); ?></option>
<?php wp_get_archives(‘type=monthly&format=option&show_post_count=0’); ?> </select>

which replaced this line:

<?php wp_get_archives(‘type=monthly’); ?>

I then had to modify the style sheet so that the drop down box would look right in the browser.  The section I added will be different for each theme, but for the one I’m using it was this:

.sidebar-box select {font-family:Tahoma;font-size:11px;}
.sidebar-box select option{font-family:Tahoma;font-size:11px;}

The main idea is to modify the font that is displayed when the select box isn’t selected and the font that is shown for each option.  How you do that is going to be dependent upon your blog’s structure and theme.

In summary, select box is an easy change and so is the stray quotes.  Maybe I’ll take it upon myself to have a lot of random quotes appear in the footer area of my site.  Give people a reason to scroll to the bottom of the page. 🙂