Slick Carousal in RTL Mode

carousel-night-hero-image

img_0448I have been scratching my head all night to get this thing fixed! We have been using Slick Carousal in one of our projects and it breaks whenever ‘dir=”rtl” is injected into the body tag.

I wish I had came across this before because it costed me a good night sleep and 2 cups of coffee to make it work in the arabic version of the website.

The solution was plain simple, you basically have to use the following option when initializing the carousal:

$('.single-item-rtl').slick({ 

rtl: true 

});

Source: http://kenwheeler.github.io/slick/

 

Why WordPress doesn’t detect custom post type templates?

wptemplate

I made a custom post type with the machine name special_media_post and wordpress was simply not seeing the single-special_media_post.php. I was at a complete lost. It kept defaulting to the index.php until I tried the following solution:

Visited the permalinks page (which will flush it) and checked again. WordPress probably just needs to be nudged to recognize your addition to the hierarchy.

 

Source: http://wordpress.stackexchange.com/questions/96785/custom-post-type-single-custom-php-not-working

WordPress admin bar not showing on front end for custom theme

how_to_seo_wordpress

Some custom wordpress theme doesn’t show the admin bar into the theme page same with the wp_head() and the wp_footer() wrote on the templates files. To resolve that problem just add the following code into your function.php or into your own plugin:

function admin_bar(){

  if(is_user_logged_in()){
    add_filter( 'show_admin_bar', '__return_true' , 1000 );
  }
}
add_action('init', 'admin_bar' );

Source: http://stackoverflow.com/questions/21277190/wordpress-admin-bar-not-showing-on-frontend

How to fix PHP.INI that is not updating in an apache mac setup

php-style-006

If you issue the following command in terminal:

php --i | grep ini

This will show you the loaded pho configuration file. My output was this:

Loaded Configuration File:         /usr/local/etc/php/5.6/php.ini

But when I upgraded my MacOS from El Capitan to Sierra, updating the above file didn’t reflect any change on my development websites. WordPress was still showing 2 MB even though I was using the following:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

After googling here and there, I found a solution. Thanks to Gergely on stackoverflow here.

First use phpinfo to find out the current loaded file.

You would see:

Loaded Configuration File  None

now open your terminal:

cp /etc/php.in.default /etc/php.ini

Thats it. Make any change to the newly copied file and it would update in the webserver without any issues 🙂

How to Speed Up Slow WordPress Admin

wordpress-slow-600x250

There can be many reasons a wordpress admin could get slow. First thing first, I used P3 plugin to find out which plugins are the root cause. I found out that WPML’s string translation was using the most resources even though I didn’t need it running all the time.

Disable WPML String Translation

The reason it takes too much of memory is because each time it checks the whole website source for possible string for translation. So I disabled it and noticed significant performance difference.

Clouflare

Secondly, if you’re using CloudFlare then there is no reason you should enable all of its features for the wp admin as most of the functions are dynamic and a cache would actually do more harm than good.

So I logged into my cloudflare account, chose my website domain and opened Page Rules.

Create a new rule for the wp-admin directory:

In the URL bar, add the following: <your-website-domain>/wp-admin* </br></br> Then the settings: Browser Integrity Check On Always Online Off Security Level High Cache Level Bypass Disable Apps Disable Performance

then did the same for previewing posts and pages with an addition of one extra setting:

In the URL bar, add the following: <your-website-domain>/wp-admin* </br></br> Then the settings: Browser Integrity Check On Browser Cache TTL 30 Min Always Online Off Security Level High Cache Level Bypass Disable Apps Disable Performance

Thats it. Now click on ‘Save and Deploy.

Good Work! You saved yourself from wasting precious development time 😉