Prohibiting access to wp-config.php improves site security. You are encouraged to refer to this information to maintain your website. Put the following code in the “.htaccess” file. <files wp-config.php> order allow,deny deny from all </files>
Category Archives: Code
Hiding php.ini information improves site security. You are encouraged to refer to this information to maintain your website. Description in the ‘php.ini’ file. display_errors = off In “.htaccess” files. <Files php.ini> deny from all </Files>
Has SSL been installed on your website? The introduction of SSL is recommended for all websites because of its security and SEO advantages. Full-page SSL is particularly desirable for shopping and crowdfunding websites where personal data and payments are involved. The following code is recommended for full-page SSL. Put this in the “.htaccess” file. ※Be…
If you are building multiple WordPress sites, you face the problem of having to ‘rewrite URLs’ when duplicating them. The following code is recommended to solve this problem before it happens. Please describe it in the theme’s ‘functions.php’ file. /* Description in functions.php */ add_shortcode(‘url’, ‘shortcode_url’); function shortcode_url() { return get_bloginfo(‘url’); } add_shortcode(‘tdir’, ‘tmp_dir’); function…
Learn how to implement a table of contents in WordPress without using a plugin. This method does not use JQuery and is also the implementation method introduced on this website. It takes less time and man-hours, if you like. The following steps are to be implemented. Edit functions.php. Editing CSS. Set display conditions on the…
Learn how to display blog cards in WordPress without using a plugin. Plug-in non-use has various advantages, such as reducing server load and maintaining site display speed. WordPress has a large variety of plugins, but you want to customise it without using as many as possible. We would like to introduce an implementation method that…
Implement dark mode in WordPress.No plugin is required. 1.JavaScript description. Put the following js code in the header. document.addEventListener(‘DOMContentLoaded’, function() { const toggleButtons = document.querySelectorAll(‘.toggle-mode’); toggleButtons.forEach(function(button) { button.addEventListener(‘click’, function() { const currentMode = localStorage.getItem(‘data-mode’); const newMode = currentMode === ‘dark’ ? ‘light’ : ‘dark’; localStorage.setItem(‘data-mode’, newMode); applySavedMode(); }); }); applySavedMode(); }); function applySavedMode() { const…
Learn how to make ContactForm7 js and css load only on specified pages in WordPress without using a plugin. Normally, when ContactForm7 is installed, js and css are loaded on every page, which slows down the display speed, but this can be prevented by using this method. Edit functions.php. If a child theme is available,…
Learn how to introduce policy features in WordPress without using a plugin. Plug-in non-use has various advantages, such as reducing server load and maintaining site display speed. There are many diverse plugins for WordPress, and for SEO, there are excellent plugins such as All in One SEO Pack and Yoast SEO. However, SEO plug-ins are…
In this article, we will show you how to implement syntax highlighting in WordPress without using a plugin. Syntax highlighting is often used to display source code on websites and blog sites. This website has adopted “Prism.js” after various trials. The reasons are as follows. Light. Many languages handled. Flexible.(Various customisations are possible.) Easy to…
- 1
- 2