I don’t remember why I needed this solution at all, most likely because of infinitive redirects after editing .htaccess file. Below is a redirect option via functions.php: function force_https () { if ( !is_ssl() ) { wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 ); exit(); } } add_action ( 'template_redirect', 'force_https', …
Read More »Webmaster notes
How to display any module in the text of the material in Joomla
The case is simple – in the text canvas, display some module. The implementation is also simple: In the Plugins section, make sure that the Content – Loading Modules plugin is enabled, then edit the material and add this: {loadmodule module_name} where instead of module_name write the name of the …
Read More »301 redirect to https for WordPress multisite
The multisite mode in this case is when the main domain and its subdomains work in the same base and the subdomains are a mirror of the main site. If I add a standard 301 redirect to .htaccess then subdomains via http subdomains start redirecting to the main site. This …
Read More »Display video instead of preview in K2 Joomla category
The task is to display a video instead of a preview of the K2 material in the general output of materials in the category. here wrote about how to display a video from YouTube instead of a picture of the K2 material inside the material. To display images in categories, …
Read More »Display video instead of preview in K2 Joomla material
The task is to display a video from YouTube on the K2 material page instead of the uploaded image. The output of the image on the site is like this: <?php if($this->item->params->get('itemImage') && !empty($this->item->image)): ?> <!-- Item Image --> <div class="itemImageBlock"> <span class="itemImage"> <a class="modal" rel="{handler: 'image'}" href="<?php echo $this->item->imageXLarge; …
Read More »Different content for More Lang language versions in a template using a shortcode
I like More Lang plugin because there are no duplicate pages and posts for other language versions in the admin panel. But I had a problem – for the banners on the home page (which are embedded in the theme) there was no way to change the texts dynamically, depending …
Read More »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 hide any blocks when submitting Contact Form 7
Forms can easily be hidden after they’ve been filled out and submitted, because the form gets a class sent when submitted. But there are lot of cases when you need to hide blocks that are placed outside of this form, but which are logically related to the form. If you …
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
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 »