howto

Make Your WordPress Theme Translatable

Today I made my Pets & Vets WordPress Theme Translatable. At first it seemed a little daunting, here is a quick guide.

Step 1: Add some functions.

Add this to your functions.php file, change “YOURTEXTDOMAIN” to something unique, like your theme name.

// language files
add_action('after_setup_theme', 'theme_setup');
function theme_setup(){
    load_theme_textdomain('YOURTEXTDOMAIN', get_template_directory() . '/languages');
}

Step 2: Edit your text

Go through every file in your theme, for simple text, that isn’t already wrapped in php, use the “_e(“option below. For text that is already wrapped in php, use the “__(” option below. Also, don’t forget to replace YOURTEXTDOMAIN with the one set in the first step.

<?php _e("This is the translatable text", "YOURTEXTDOMAIN");?>
<?php the_content(__('Read more...', "YOURTEXTDOMAIN"));?>

Step 3: How to create a PO file

Goto the link below and upload your theme files. After a few moments, it will give you the source for your PO file, or you can download the PO file GZipped… Unzip it and add it to your “/languages” subfolder.

http://www.icanlocalize.com/tools/php_scanner

Theme Authors! You’re Done….

Now for the translators:

Step 4: How to create a MO file

Download Poedit from here: http://www.poedit.net/download.php and install.

Screen Shot 2014-04-03 at 3.25.34 PM

Click on “Create new translation” and open our new PO file.

Select the language you’re translating it to. Make your changes to the translation. Save.  Add your new PO and MO files to the language folder.

Step 5: Implementation

Open wp-config.php and add the code below with your corresponding language code. Here are the country and language codes.

define ('WPLANG', 'fr_FR');
howto

Editing the Host File on OSX

The hosts file is a text file that maps hostnames to IP addresses. Upon typing a url address on the browser, the system is checking if there is a relevant entry on the hosts file and gets the corresponding IP address, else it resolves the IP via the active connection’s DNS servers.

The hosts file can be edited to block certain hostnames (like ad-serving/malicious hosts), or used for web development purposes, i.e. to redirect domains to local addresses.

Editing the hosts file

Editing the hosts file in Mac OS X – Leopard, is a pretty easy task, especially if you are familiar with the terminal.

Step 1 – Open the Terminal.app

Either by start typing Terminal on the Spotlight, or by going into Applications -> Utilities -> Terminal.

Step 2 – Open the hosts file

Open the hosts by typing on the Terminal that you have just opened:

$ sudo nano /private/etc/hosts

Type your user password when prompted.

Step 3 – Edit the hosts file

The hosts file contains some comments (starting with a #), as well as some default hostname mappings.

Append your new mappings underneath the default ones. Or edit the default values if you know what you are doing!

You can navigate the file using the arrow keys.

Step 4 – Save the hosts file

When you’re done editing the hosts file, press control + o to save the file.
Press enter on the filename prompt, and control + x to exit the editor.

Step 5 – Flush the DNS cache

Terminal command to flush the DNS cache, and have your host file changes to take immediate effect:

$ dscacheutil -flushcache

Ok you’re done.. now get back to work.. :)

Brick: Webfonts that actually look good

Brick: Webfonts that actually look good

“In the age of the Internet, we’ve found ourselves in yet another typographic battle. In an effort to speed up loading times, we’ve compressed fonts, and along the way, we’ve lost the majority of the quality of rendered type.

Let’s change that. The fonts served by Brick are clones of the original, converted without modification to WOFF format for high quality rendering and fast loading across all modern browsers.”

brick.im

topbar

Re-enabling Pets & Vets Slider for Mobiles

I wouldn’t recommend doing this for UX reasons, plus it has not been tested thoroughly… and I doubt anyone will want it..

But someone just asked me  how to do it, so here it is incase anyone else is after it…

Copy the code below into Theme Options > Custom CSS

.homehead {
display: block !important;
}
@media (max-width: 767px) {
#homepageslider {margin: 0 auto 20px!important; max-width:100%;}
#homeheadlinks {margin: 0 auto 40px!important; max-width:100%;}
#homepageslider {min-height: 0px; height: auto;}
.carousel .item {min-height: 0px;}
}
@media (max-width: 991px) and (min-width: 768px) {
#homepageslider,#homeheadlinks {margin: 0 auto 20px!important;}
}/* end */

Do you want to run an online Pet Store? Do you already run a Pet Store, Animal Shelters, or maybe you’re an Animal Trainer or Vet? Take a look at my Pets & Vets (WooCommerce, WordPress, Bootstrap 3) theme on ThemeForest. Check it out. 

Screen Shot 2014-03-14 at 9.51.07 AM

Tree Rings + Record Player.

I’ve done no research on this video.. I do know it was created by Bartholomäus Traubeck. I’m guessing it reads the grooves with a laser then its put though some sort of midi program, with a scale and synth set.. I honestly have no idea how it works…I should probably read up before posting about it… but it looks and sounds great… and thats why it’s going to be my first post under unfamo.us/inspiration.. woohoo.

howto

How to restart Finder in OSX

Simple trick, someone else out there might find it useful… Emptying the Trash crashed my Finder last night… So  just open spotlight  ” ⌘ space ” type terminal and hit enter:

Then type “killall -KILL Finder

If that doesn’t work try the other solutions below:

The Finder crashed:
killall -KILL Finder
(you can also restart the Finder by holding option + rightclicking the Finder icon in the Dock and selecting Relaunch. It doesn’t always work though.)

The Dock crashed:
killall -KILL Dock

Spaces crashed:
killall -KILL Dock

The Menubar crashed/refuses to be clickable:
killall -KILL SystemUIServer