The task is relevant if hosting subdomains refer to the root of the main site, or if several domains are registered as aliases to each other. If you need to write noindex/nofollow etc., you can simply write a condition in index/header section: <?php $host = $_SERVER['HTTP_HOST']; if($host == "old.domain.com" or …
Read More »Articles
Error installing plugins – sprintf(): Too few arguments in class-bulk-upgrader-skin.php
I got this error after installing a third-party free theme. Full text of the error: Warning: sprintf(): Too few arguments in /wp-admin/includes/class-bulk-upgrader-skin.php on line 152 Here is the solution – in the file /wp-admin/includes/class-bulk-upgrader-skin.php find and replace this code: if ( $this->result && ! is_wp_error( $this->result ) ) { if …
Read More »Fixed panel that can only be closed once
The solution was for the message “We use cookies to enhance your experience in our web site. By visiting it, you agree our Cookies Policy.” It is important that the panel does not reappear after closing/accepting the agreement. Here is the HTML, CSS, JS code to implement the panel on …
Read More »Popup image on click without href
A very elegant solution, with which the image will not be wrapped in <a href=””></a>, image will float on click to the center of the screen and will be able to close both on the top cross and on a click on a translucent background. Image code: <div class="image__wrapper"> <img …
Read More »How to change 302 to 301 redirect in Opencart
By default, OpenCart automatically enables 302 redirects. However, using 302 redirects is not ideal for SEO purposes because they indicate a temporary redirect. For better search engine optimization, it’s important to use 301 redirects, which signify a permanent move. This article provides a step-by-step guide on how to change 302 …
Read More »How to display search form in WordPress theme
First you need to check if the file searchform.php exists in the root of the site theme. The content of this file should be like this: <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ) ?>" > <label class="screen-reader-text" for="s">Search: </label> <input type="text" value="<?php echo get_search_query() ?>" name="s" id="s" /> …
Read More »Anchor link and smooth transition
This case is used for landing pages, for pages with a lot of content. The default anchor link looks like this: <p><a href="#mylink">Anchor link </a></p> <div id="mylink"></div> Sometimes, instead of <div id=”mylink”></div> this code <a name=”mylink”></a> is used, the result will be the same, but w3c validators will complain about …
Read More »How to display wordpress menu anywhere in your theme
This code can be inserted anywhere in the template to display the menu. In this task, I change the standard directory menu to a custom menu. wp_nav_menu( [ 'menu' => 'Website navigation' ] ); Replace Website navigation with your name for the menu you want to display.
Read More »How to change text for Add to Cart button for Woocommerce
This task can be solved by editing the translation files of your theme. But you can use a hook that allows you to rename the “Add to Cart” button faster. In the file functions.php add the following code: add_filter( 'woocommerce_product_single_add_to_cart_text', 'tb_woo_custom_cart_button_text' ); add_filter( 'woocommerce_product_add_to_cart_text', 'tb_woo_custom_cart_button_text' ); function tb_woo_custom_cart_button_text() { return …
Read More »How to remove unused tabs for product editing in WordPress admin panel
By default, the product edit page has several tabs that are never used for simple stores. In this article, the code you need to put in functions.php in your theme folder. In this example, the Deliveries tab is removed, but you can uncomment any line and the tab that you …
Read More »