Archive for Code

Searching an Excel Sheet with JavaScript

Tags: , ,

This took some significant amount of time to put together when it really shouldn’t have. Sharing the code here to save anyone else the trouble. Objective We will be trying to set up an HTML page that allows users to input a search phrase and trigger a search through an Excel sheet with data. Approach [...]

Continue reading » 7 Comments

Modifying WordPress RSS Feed

Changing the WordPress RSS is one of the most arduous tasks ever … unless you know how to use hooks. Hooks are basically functions that do something to an existing process. Think about it this way, if you were making a cup of coffee, a hook would be sugar that makes a bitter tasting beverage [...]

Continue reading » No comments

WordPress Get Recent Comments Function

A friend asked me to put up recent comments on http://www.7achy.com You could use a plugin, but writing your own function gives you a lot more control. Here is a function called getRecentComments [surprise surprise!] that puts out basic information about recent comments in an unordered list. Copy and paste the function into your theme’s [...]

Continue reading » No comments

Related Posts WordPress Function

Ever wanted to know how you can generate related posts with a function? Here’s the code for a related posts based on tags and categories; fully commented. Copy and paste the function into your theme’s functions.php then call it in your loop or anywhere else like this: echo getRelatedPosts($postID); Replace $postID with the post ID [...]

Continue reading » No comments

Trimming Strings in PHP

Suppose you have a 10 pixels post header and had a post title “Supercalifragilisticexpialidocious” … the clever monkey in your head will soon realise that you cannot unscrew anything with a rubber hammer. You need a new tool. Here it is: a function to trim a string and append a little bit extra on the [...]

Continue reading » 1 Comment