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 »Articles
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 »How to display the Nextgen Gallery
On this page I publish shortcodes to insert into an article, or into a template. Option 1 – default: [ngg src="galleries" ids="1" display="basic_thumbnail" thumbnail_crop="0"] Option 2 – show multiple galleries: [ngg src="galleries" ids="1,3" display="basic_thumbnail" thumbnail_crop="0"] Option 3 – displaying images by tags: [ngg src="tags" ids="primertega" display="basic_thumbnail" thumbnail_crop="0"] Option 4 – …
Read More »Canonical for pagination in Opencart below version 3
Pagination pages may not have canonicals at all by default. To add their automatic generation, open the file /catalog/controller/product/category.php and in it after the line $this->load->model(‘tool/image’); add the following code: if (isset($this->request->get['page'])) { $page = $this->request->get['page']; $pathx = explode('_', $this->request->get['path']); $pathx = end($pathx); $this->document->addLink($this->url->link('product/category', 'path=' . $pathx ), 'canonical'); } …
Read More »Redirect 301 from https to http
This is one of the examples of the implementation of redirection from https to http. RewriteEngine on RewriteCond %{HTTP:HTTPS} =on [NC] RewriteRule ^(.*)$ http://domainname/$1 [R=301,L]
Read More »Include the file and generate title
It happens that the generated data is stored in a separate file. And the task is to output, for example, titles with a preliminary check of already existing values (not empty) in a third-party file. An example of the implementation is below: <?php include($_SERVER['DOCUMENT_ROOT']."/seo.php"); if(isset($seoh1) AND $seoh1!='') { echo $seoh1; …
Read More »