Category Archives: Coding

WordPress .htaccess fixes for Page Speed

By | Wordpress | No Comments

I recently finished a job and i am trying to get a score of 100 on Google Page Speed. So far I have fixed a lot of stuff and here are the .htaccess changes that focus on caching and gzip minification.

Header unset Pragma
FileETag None
Header unset ETag

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##

<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

# Specify a Vary: Accept-Encoding header
<IfModule mod_headers.c>
  <FilesMatch "\.(js|css|xml|gz)$">
    Header append Vary: Accept-Encoding
  </FilesMatch>
</IfModule>

Dante theme x custom post tags

By | Wordpress | No Comments

Dante theme gives you the ability to add tags to your posts but… surprisingly it won’t show up with you try to see the posts associated with that custom post type.

I looked online and found this thread and there’s a simple code that you have to add to your functions.php:

function wpse28145_add_custom_types( $query ) {
    if( is_tag() && $query->is_main_query() ) {

        // this gets all post types:
        $post_types = get_post_types();

        // alternately, you can add just specific post types using this line instead of the above:
        // $post_types = array( 'post', 'your_custom_type' );

        $query->set( 'post_type', $post_types );
    }
}
add_filter( 'pre_get_posts', 'wpse28145_add_custom_types' );

Dante Theme x TinyMCE issue

By | Wordpress | No Comments

I’ve been working on this project for a coulpe of weeks using the Dante theme and suddenly the page builder stopped working. I tried to activate it inside the post editing page and all I got was a message like Loading…, I checked the console and there was a TinyMCE warning and when i changed i received an error that it couldn’t save.

I then went to Google to try to find people having the same problem and all I found was a thread on their support but I couldn’t access because there was a problem with my client’s purchase code so we lost a couple of days trying to get access. Once we were in I found a few other threads and no solution from them. There was only one guy that found out the problem and I am sharing here because it would be easier to find and access.

You probably get this error because, like me, you entered text mode and then tried to activate page builder. You simply have to go to Visual Mode and then activate page builder!

Text Mode > Visual Mode > Page Builder

Not sure if this was related to a plugin, I saw some people saying it was ACF, but either way… Only activate Page Builder when in Visual Mode.

Server Side Includes fix for Yosemite

By | Coding | No Comments

When Yosemite released i decided that i was going to do a clean install and abandon MAMP. I followed this post to install apache and this post to configure the virtual hosts properly. I have to say it was not easy but i survided.

Then i spent almost a day googling why i wasn’t able to make SSI work. I almost gave up and tried Hammer and Codekit includes.

After trying every single thing i found a website that had a linux guide that gave me an idea. Since apache changed a lot and i had to uncomment several modules to make stuff work, i decided to look for anything related to includes and found on line 103 this:
LoadModule include_module libexec/apache2/mod_include.so

Just uncomment this and the other 2 lines that have .shtml and you should be good to go.

Adding one of my virtual hosts here in case that helps.

ServerName noblat
DocumentRoot "/Users/fenda/Sites/noblat/"
<Directory "/Users/fenda/Sites/noblat/">
Options Indexes FollowSymLinks Includes ExecCGI
AddType text/html .shtml .html .htm
AddHandler server-parsed .shtml .html .htm
AllowOverride All
Order allow,deny
Allow from all