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 »Missing write access to /usr/local/lib/node_modules when installing Jshint for Vscode
The problem is described in the topic. Below is a screenshot of this error: Here is the solution, you just need to change the permissions: sudo chown -R $USER /usr/local/lib/node_modules After that npm install -g jshint and any npm install works fine.
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 »