allow cross domain font access

custom CORS configurations to allow cross domain font access

This sets the Access-Control-Allow-Origin CORS configuration to allow pulling from all domains. You may also want to serve fonts to only specific domain, for that you have to replace ‘*’ with the domain names seperated with comma.

Customize Google Maps

Custom styles for google maps: Snazzy Maps is a community built around creating great looking styles for Google Maps. As of version 3 of the Google Maps API custom styles can now be applied to maps. This allows developers and designers to pick a style that matches the theme of their website. We love great […]

programmatically add wpml string translation

First we need to register the string on wpml translation table.

The above function will return a string_id and we will need this id for icl_add_string_translation() function to add labels for other languages.

Alternatively, we can use icl_get_string_id() to get the string_id as:

Leverage browser caching

Enalbe mod_expires on server LoadModule expires_module modules/ And make following changes on htaccess file. enable Cache-Control headers

enable Expires headers

You might also turn on the ‘KeepAlive’ connection. Read more on ‘keepalive’ Add the following code on htaccess to turn on ‘KeepAlive’, And you should know that Keepalive will improve website loading […]

present a pdf file for download via PHP after checking some rules

First we create a rule on htaccess and redirect the pdf files to a php with its path as query string

The sample code for the pdf-viewer.php.

Remove illegal characters from files during uploading on wordpress

wp_handle_upload_prefilter allows user to change the files during uploads. ex.

What is the difference between inversedBy and mappedBy on Doctrine?

mappedBy has to be specified on the inversed side of a (bidirectional) association inversedBy has to be specified on the owning side of a (bidirectional) association from doctrine documentation: ManyToOne is always the owning side of a bidirectional assocation. OneToMany is always the inverse side of a bidirectional assocation. The owning side of a OneToOne […]