Just put this code on your .htaccess file: Where example.com should match your domain.
Category Archives: Uncategorized
How to disable directory listings?
Simply add this line to the top of your .htaccess file:
How to restrict access to some files on server?
This .htaccess code should return 403 error on several sensivel files that usually stay forgotten on the server. Credits:https://www.linkedin.com/learning/wordpress-developing-secure-sites/remove-unused-plugins-and-themes
[JS] Closures
Closures is a function inside a function that relies on variables in the outside function to work. Or more elaborated: A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function’s scope from an inner function. In […]
[JS] How to make an object in JS
Here is one possible way of creating an object: We could also use this alternative syntax and accomplish the same result: Additionally we can add methods to this object: Now, since all the variables are hardcoded inside the object let’s see how we can turn this a bit more abstract: Reference:JavaScript Essential Training https://www.linkedin.com/learning/javascript-essential-training-3
[JS] global vs const vs var vs let
Here’s an example of how to use each one of the above keywords. As the programName variable is not prefixed with var, let or const it is a global variable with a global scope. Meaning that it is visible anywhere in the script regardless it is being accessed inside any function. On the other hand, […]
[wordpress] How to make an AJAX request?
Going to show 2 ways of performing AJAX requests in wordpress. I’ll be using jQuery for the sake of simplicity. Using hooks Let’s start off by adding jQuery and a custom javascript file to our page: Now, the AJAX request will have to be done to the admin ajax url. Here is one possible way […]
[wordpress] Template Hierarchy
Let’s start by an example: If your blog is at http://example.com/blog/ and a visitor clicks on a link to a category page such as http://example.com/blog/category/your-cat/, WordPress looks for a template file in the current theme’s directory that matches the category’s ID to generate the correct page. More specifically, WordPress follows this procedure: Looks for a template file in […]
[wordpress] Theme Files Organization
This isn’t a strict rule but wordpress will look for these structure/files by default: Reference: https://developer.wordpress.org/themes/basics/organizing-theme-files
[wordpress] How to get child theme / main theme path and URI?
Since WordPress 4.7, these functions are available: get_theme_file_uri() – if using a child theme, it will return the child theme’s full URI. Otherwise, it will return the main theme full URI. e.g. It’s also possible to send a subfolder/file as parameter, like so: get_theme_file_path() – same as get_theme_file_uri() but will return the full path of […]