Wp_enqueue_scripts

There’s a new way to load WordPress stylesheets from within your templates. In the older versions of WordPress, the stylesheets were hard coded on the theme’s header file. The proper way to load your stylesheets is via the functions.php file. Here are the differences.

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 the code is placed 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.

Remove Paragraphs From Content

Here’s a really easy way on how to remove paragraphs orĀ <p></p> from the WordPress content.

In the WordPress loop, look for the code ‘the_content().’ Add this command just before it:

remove_filter ('the_content', 'wpautop');
the_content();

That essentially removes all the paragraphs from the WordPress content.

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 mod_rewrite, you need to restart Apache. That should fix any of the route issues that you may have. If mod_rewrite is disabled, you usually get 404 errors or file not found. The Laravel routes simply doesn’t work.

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 where to put the Laravel files each time I install. It’s either /var/www or /home/user/. I’m using the Ubuntu standard PHP5 install. You have to specifically install php5-curl in addition to the standard PHP package. I think mcrypt is already in the PHP5 package, but to be sure I added it to the install. Here’s the command.

PHP

sudo apt-get install php5 php5-curl php5-mcrypt

App/storage

cd /home/user/laravel/app/
chmod -R o+x storage

These two things seem to solve most of the Laravel installation issues.