Saturday , February 22 2025

iryna

Hi there! My name is Iryna, I am a web developer from Ukraine. While working on freelance projects I often face different technical issues and in this blog I publish articles on how to solve them. I am also interested in digital drawing and in this blog you will find brief tutorials that helped me and hopefully can help you as well.

How to add 301 redirect to https for Yii2 without .htaccess

I’ve tested different redirect options for .htaccess, but sites keep giving “redirected you too many times” error. Here is the working code to solve the problem. In the file /config/web.php you need to find: 'bootstrap' => [ 'log', 'app\components\Bootstrap', ], and place below: 'on beforeRequest' => function ($event) { if(!Yii::$app->request->isSecureConnection){ …

Read More »

How to display page/post content in WordPress theme

This case is relevant for cases when you need to display all the content of a particular page in a template. Below is an example PHP include for implementation. <?php $post1 = get_post( 100500 ); $text = $post1->post_content; // post content echo apply_filters('the_content', $text); // output content ?> Instead of …

Read More »

Setting up JSHint for Vscode

Vs Code

Here is an example of the contents of the .jshintrc file (it should be inside the project, or in the project folder). { "camelcase" : true, // Variable names in camelCase style "undef" : true, // All non-global variables must be declared before they can be used "quotmark" : true, …

Read More »

How to add widget for WordPress

You must first make an area for displaying the widget through the admin panel, then connect the widget in the template file. For the first part, use the code and place it in the template’s functions.php. register_sidebar(array( 'name' => 'newwidgetblock', // name of the area in admin panel 'id' => …

Read More »

Display categories above product list for WooCommerce

To display categories above the list of products, you need to enable this checkbox in the WooCommerce settings, but then the categories will be displayed the same as the products, there will be no separator between categories and products. The following code makes it possible, with the “Show products only” …

Read More »

How to allow HTML tags in WordPress category description

By default, the engine cuts out all HTML tags, and with them the content that we write in the description field for WordPress categories. To teach WordPress to understand tags, you need to add the following code to the functions.php file: remove_filter('pre_term_description', 'wp_filter_kses'); remove_filter('pre_term_description', 'wp_kses_data'); By the way, to add …

Read More »