If your site uses the old version of WordPress and the Contact Form 7 plugin, it is enough to use the code in the Advanced settings tab: on_sent_ok: "yaCounterXXXXXXXX.reachGoal('mygoal');" Where XXXXXXXX is the counter ID in Yandex Metrika, mygoal is the name of the goal that was previously created in …
Read More »Wordpress
How to recursively replace a domain, word, or phrase in a database
I describe this task using the example of a transferred WordPress site to another folder of another domain. To implement it, you need to search the database by domain name, you will see in which tables there are records with this domain. Then make a SQL query in the format: …
Read More »How to host Wp site in a separate folder of the domain
This article is about moving a site to an internal folder of another site. 1. Transfer site files to a new folder. 2. Export the database, in the dump change the old domain to the new one (with the folder name). For example, newdomainname.com/folder (Important! Do not put a slash …
Read More »Service tags for Contact Form 7
The most common question is “How to find the Contact Form 7 url of the page from which the form was filled out?” Here is a list of service tags that can help you get data about the user who filled out the form: [_remote_ip] Sender's IP address [_user_agent] User …
Read More »Perfect robots.txt for WordPress
In this article I have posted 2 examples – simple and advanced. In each example there will be lines that you need to change, below there will be notes with specifics of what should be changed. 1st robots.txt, optimized for SEO User-agent: * Disallow: /cgi-bin Disallow: /? Disallow: /wp- Disallow: …
Read More »How to display a product attribute anywhere in Woocommerce
With this code, you can display a product attribute in the template, for example, “size”. global $product; echo $product->get_attribute('size'); Below I publish a method for displaying a property with an additional icon output, if this property is filled in: <?php $subheadingvalues = get_the_terms( $product->id, 'pa_time'); if ($subheadingvalues): ?> <div class="labeltime"><i …
Read More »How to hide the Details tab in the Woocommerce product card
The attributes of the product are displayed in the tab Details/Additional Information. If only a 1-2 of attributes are displayed on your site, then the tab will look ridiculous without content. There are two options: hide the tab using css styles, or delete it using the engine. Option 1: hide …
Read More »How to display product SKU in Woocommerce product card
As it often happens, we do not need product SKU where it is placed in the template. To display in the right place, use this code: <?php echo '' . $product->sku . ''; ?> When I published this code on a test project (in /woocommerce/single-product/short-description.php) as a result, the product …
Read More »How to display all attributes of a Woocommerce product
Often I need to display all the attributes of a product in another place in the template, not in a separate tab with characteristics. To solve this case, use the following code: <?php global $product; $product->list_attributes(); ?>
Read More »How to display the Woocommerce product title in a theme
The product name in WooCommerce is no different from the title of the post in the Posts and Pages. Therefore, to display the WooCommerce product name anywhere in the template, add the code: <?php the_title(); ?>
Read More »