Wp_enqueue_scripts

There’s new way to load WordPress stylesheets from within your template.

The old way was:

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

The new way uses wp_enqueue_scripts and you place your code in functions.php.

function sample_theme_scripts() {
	wp_enqueue_style( 'style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'sample_theme_scripts' );

Both codes work, but the latter will give you less headache.

If you use multiple stylesheets and JQuery at the same time, then you can use wp_enqueue_scripts to load them all at once. Using wp_enqueue_scripts will help you avoid conflicts from loading multiple copies of the same script. For example, you can deregister the standard WordPress JQuery and use your own JQuery version. This method is particularly helpful when you are writing your own plugins, much more so than using it on themes. Nevertheless, it’s good practice to use wp_enqueue_scripts to load stylesheets.

Enable Mod Rewrite in Ubuntu

Another issue when installing Laravel on the Ubuntu server is to make sure you have the mod_rewrite module enabled. You can turn it on by invoking the following command. sudo a2enmod rewrite sudo service apache2 reload Once you've enabled … [Continue reading]

Laravel: Curl and Mycrypt

I've installed Laravel at least a dozen times. Each time, there's always something new that goes awry during the installation. If it's not curl, it's mcrypt, or maybe the app/storage permissions. I think it's just the fact that I'm experimenting … [Continue reading]

Keep Your SSH Sessions Alive

If you work on servers via Terminal using SSH (secure shell), one of the more annoying things that happens quite regularly are timeouts. If there's no activity between your SSH client and the server, your terminal is closed because your session has … [Continue reading]

Display Post From A Year Ago

Here's a cool little WordPress script to display a post from a year ago. You can display your old content to entice your readers to view older articles. You can display your old posts on your theme's sidebar, after your post content, or just anywhere … [Continue reading]

Hide WordPress Admin Bar

There are reasons why you want to hide the Admin Bar from your users. If users don't have edit rights, then there's really no use for an Admin bar. Another reason is if the account is shared with others, you don't want users to reset the password. … [Continue reading]

Shades of Color

Part of creating web design involves working with shades of color. At times, using a color for a HTML link may look good indeed, but the same Hex color code may not necessarily work as a background color. As a designer, you may have to work with … [Continue reading]

Atom Editor

Github released yesterday a new editor called Atom. It's built on HTML, CSS, Javascript and Node.js. It's designed to be extensible via add-on packages so it can be used for a number of things, but it's mainly used as a text editor. The Atom core, … [Continue reading]