Category / Very Short Snippet

Of course, you know dangerouslySetInnerHTML attribute. This is very useful when you need to insert a custom own HTML in your page. …is React’s replacement for using innerHTML in the browser DOM. In general, setting HTML from code is risky because it’s easy to inadvertently expose your users to a cross-site scripting (XSS) attack. So, you […]

Read More

Edit your wp-config.php file, located in WordPress root folder, and add or replace define(‘WP_DEBUG’, true); In this way WordPress will print the logs on the screen. This may be very annoying, so you would like to redirect all logs in a file.

As usual, please don’t hesitate to leave any questions or comments in […]

Read More

How to check if an element DOM exists Be careful when you wish if an element DOM exists. If you use:

This method doesn’t work because jQuery will return an [Object object] even if the element doesn’t exist. We may use a couple of methods to be sure that an element exists:

Read More

How to merge one or more images

Read More

Let’s see some useful method about NSURL Return the name of a file (with or without extension) from NSURLRequest:

Return the file extension from NSURLRequest:

Finally, How to convert an address from NSString to NSURL and vice versa:

Read More

A simple way to create a slug:

Read More

In WordPress, you can organise the category with a relationship parent/child. This means that a single post belongs to multiple categories. Let’s see how to get the parent category of a post:

     

Read More

Sometimes, you may wish to check a POST variable and when it is not set then get a default value. The first approach could be:

Read More

Administrator or subscriber? Let’s see a quick way to check it!

Shorter

Of course, you can check also the rest of WordPress roles, such as “subscriber” for example.

Read More