Tag Archives: WordPress
Enable WordPress Permalinks On IIS
By default IIS will throw an error (usually a not found error, 404) when WordPress is using permalinks.
The reason of that is because IIS is trying to map the URL you are giving it to a file on the system, which obviously does not exist. Luckily there is a simple fix to this problem.
The logic behind this solution is simple. Check if the URL provided is pointing to a file or directory on the system. If not, rewrite the action to index.php which will allow WordPress to handle it.
In order to enable WordPress permalinks on IIS add the following rewrite rule in your web.config where your WordPress is located.
1 2 3 4 5 6 7 8 9 10 11 12 | <rewrite> <rules> <rule name="Main Rule" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> |
Posted in Software Tips.
How to disable WordPress automatic updates
As of WordPress 3.7 and upwards WordPress will now check and install updates automatically. This feature is on by default and only applies to minor versions and not the major ones.
If you wish to have full control over when to update your WordPress installation then it would be wise to disable the automatic installation of the new updates. This way you will still get notified when an update is available to download but it won’t be installed automatically.
There are two methods to disable WordPress automatic update feature.
Method 1 (Recommended)
Edit your wp-config.php file and add the following line.
1 | define('AUTOMATIC_UPDATER_DISABLED', true); |
Method 2 (Advanced)
Make use of the automatic_updater_disabled
and/or auto_update_core
WordPress filters.
Move JavaScript files to footer in WordPress
Loading excessive JavaScript files in the header will usually slow down your website. This happens because while JavaScript files are loading the browser stops all the other operations till those files have been processed.
An easily solution to remedy that is to move all the .js files in the footer so they will start to load after all the graphical elements of the website have been loaded. In order to do this, open your theme’s functions.php file an place the following code at the bottom.
1 2 3 4 5 6 | remove_action('wp_head', 'wp_print_scripts'); remove_action('wp_head', 'wp_print_head_scripts', 9); remove_action('wp_head', 'wp_enqueue_scripts', 1); add_action('wp_footer', 'wp_print_scripts', 5); add_action('wp_footer', 'wp_enqueue_scripts', 5); add_action('wp_footer', 'wp_print_head_scripts', 5); |
Note: Keep in mind that in some cases some plugins might rely on specific JavaScript files to be loaded in the header, so make sure to check that everything is working properly (no errors in the java console) after moving all the files in the footer.
Posted in WordPress.
Tagged javascript, WordPress
Limit the number of months displayed by WordPress archives widget
Locate and edit your themes functions.php file. This can either be done in the admin panel by navigating to
Appearance -> Editor -> Click on functions.php file
or by directly editing the file which you can usually find under
wp-content/themes/<theme name>/functions.php
After opening the file simply add the following lines in it.
1 2 3 4 5 6 7 | function my_limit_archives( $args ) { $args['limit'] = 10; return $args; } add_filter( 'widget_archives_args', 'my_limit_archives' ); add_filter( 'widget_archives_dropdown_args', 'my_limit_archives' ); |
Replace the number 10 with the number of months that you want to display and you are done!
Posted in WordPress.
Tagged snippet, tutorial, WordPress, Wordpress archives
WordPress code highlighter
If you have a WordPress website with posts that contain code then you probably asked yourself how you can make it look better.
The past few days I was looking for a good plugin that could help me remedy that. After trying a lot of them I ended up with two that were pretty good for my needs, SyntaxHighlighter Evolved and WP-Syntax. Although both of them are rather good at what they are supposed to do, after some trial and error I decided to keep SyntaxHighlighter Evolved
since it’s results looked better in my opinion.
If you are looking for a plugin that can help you format and highlight your code to make it easier for your readers to follow and understand your code feel free to test them out and decide which one suits your needs better.
Posted in WordPress.
Tagged SyntaxHighlighter, WordPress, WordPress plugin, WP-Syntax