Tips and Tricks About Computers, Web Development, Linux, the Internet and the Like
Uncategorized
Creating Named Widgets in WordPress Made Simple
May 16th
Creating your own widgets in WordPress might seem like a complicated or confusing task but the truth is, it’s easier than you think!
In your the root of your theme directory (ex: wp-content/themes/default), you’ll find a file called “functions.php”, if you do not, create it.
Inside add:
if ( function_exists('register_sidebar') ) {
register_sidebar(array("id" => "facts_and_stats",
"name" =>"Facts and Stats"
));
}(all attributes can be found here: http://codex.wordpress.org/Function_Reference/register_sidebar)
In the backend, under “appearance > widgets”, you’ll find all available widgets and all available sidebars. You can drag a widget into the sidebar and customize it.
Then in a template file in your theme, say your “index.php” file, you can call the content of this widget with the following block of code:
< ?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar("facts_and_stats") ) { } ?>Widgets are wrapped in <li></li> by default, you can custom a group of them with a trick such as the following, where I remove all wrappers for multiple widgets by creating an array setting the before_ and afters_’s to nothing and merge it with the id and name info in another array I create inline.
$widget_args=array(
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
);
if ( function_exists('register_sidebar') ) {
register_sidebar(array_merge($widget_args,array("id" => "facts_and_stats", "name" =>"Facts and Stats")));
register_sidebar(array_merge($widget_args,array("id" => "report_card", "name" =>"Report Card")));
}Another trick I I like to do is add a quick link on the frontend for to the edit page if the user is logged in an has rights to edit widgets:
<?php if (current_user_can('manage_options')) { echo '<a href="'.get_bloginfo('url').'/wp-admin/widgets.php" title="edit this widget">edit this widget</a>'; } ?>Random cow(ish) animals preaching quotes on Ubuntu 9.10
Feb 3rd
Looking for something interesting when I login to one of my servers, I decided to whip up the following script I appended to my ~/.bashrc file.
# fortune and cowsay are needed for the snippet to work, I had to install these first sudo apt-get install fortune cowsay
COWDIR=/usr/share/cowsay/cows/; COWNUM=$(($RANDOM%$(ls $COWDIR | wc -l))); COWFILE=$(ls $COWDIR | sed -n ''$COWNUM'p'); fortune | cowsay -f $COWFILE
UPDATE:
Suggested by MrBougo, a shorter but perhaps more process intensive method:
fortune | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf | head -n1)
Breaking down the script, the first 3 parts create variables and the last command executes the cowsay and quote.
# defines the directory of the cow files COWDIR=/usr/share/cowsay/cows/; # Get a random number limited to the number of files in the directory, making clever use of % (mod) and adding 1 to make sure it doesn't return 0 COWNUM=$(($RANDOM%$(ls $COWDIR | wc -l))+1); # list the contents of the cow dir again, pipe to sed and use the number as a random line to get the name of a file COWFILE=$(ls $COWDIR | sed -n ''$COWNUM'p'); # use fortune to get a quote, pipe to cowsay and use the file as defined above fortune | cowsay -f $COWFILE;
Sup Party People? Ya like Nexuiz and Geany? Ballin' like a ninja?
Nov 16th
I’ve been quite involved in the open-source project Nexuiz recently. Most of my free time between work and school is focused on it. School’s been an interesting challenge. I’m taking two Psychology courses and a Physics class. They are both helping me get a deeper understanding of the game, the code and the community I run based around it. Nexuiz is an appealing game to people of all skills, the code base has gotten pretty strong and the effects are looking really nice. The recent addition of client-side quakec has spawned new features that simply were not possible prior to this change.
developed by blub, roughly based on a mockup I created
![]()
whose later HUD is being attempted by victim
![]()
I also began to theorize object relationships to be future projects I’d like to develop
![]()
I started working on my mapping skills (made this baby for my Technical Theatre class)
![]()
later releasing a classic Halo favorite remade and remixed collaborating with Michael “Tenshihan” Quinn and Florian “tapas” Schmidt

started building some tools to run Nexuiz game servers
![]()
which are being provided by

whom have been very kind in helping us setup, upgrade and change locations. Big thanks to mkzelda who’s helped keep us on our feet in this respect.
gave a little love to the Nexuiz Tournament website, further extending that theme back into the game:
![]()
![]()
and now the ninjaz at our 1 year anniversary

that we are celebrating with a mapping contest.
with a text editor I’m loving more each day, geany

I hope to have more tips and tricks for you all soon. I’ve been learning a lot on linux recently. I’ve been pretty focused as you can see but I’d be more than happy to answer any questions you may have. Feel free to contact me.
I've Got Good Life Hacks On The Way
Jul 16th
I’ve been swapped with work and projects recently but I wanted to let you all know I’ll be back with some good life hacks… and maybe a few computer tricks. Stay tuned.


