I want to assign ‘parent’ and ‘child’ to attributes in Woocommerce!How to enable without plug-ins.

Have you ever wished you could create ‘parents’ and ‘children’ for Woocommerce ‘attributes’, like categories?

This function used to exist but has disappeared after version upgrades.

To make it available in the current version, please add the following code to the ‘functions.php’ of your theme (or child theme if using a child theme).

if( function_exists( 'WC' ) ){
    add_action( 'init', 'ag_woocommerce_register_taxonomies_hack', 4 );

    if( ! function_exists( 'ag_woocommerce_register_taxonomies_hack' ) ){
        function ag_woocommerce_register_taxonomies_hack(){
            if( $attribute_taxonomies = wc_get_attribute_taxonomies() ) {
                foreach ($attribute_taxonomies as $tax) {
                    if ($name = wc_attribute_taxonomy_name($tax->attribute_name)) {
                        add_filter( "woocommerce_taxonomy_args_{$name}", 'ag_woocommerce_taxonomy_product_attribute_args' );
                    }
                }
            }
        }
    }

    if( ! function_exists( 'ag_woocommerce_taxonomy_product_attribute_args' ) ){
        function ag_woocommerce_taxonomy_product_attribute_args( $taxonomy_data ){
            $taxonomy_data['hierarchical'] = true;
            return $taxonomy_data;
        }
    }
}

Code Speed Web Wordpress

How to score 100 on the Google Speed Test.How to create better web vitals with WordPress themes and plugins. ‘Checklist for developers’.

This post explains how to get a score of 100 on the google speed test. 1. 1.Files2. 2.Fonts and typography3. 3.CSS framework4. 4.Conditional asset loading4.1. Inline styles4.2. Inline scope4.3. Using transients to store conditions4.4. Checking by name for loading5. 5.Image...

Continue reading

Code Speed Web Wordpress

Without plugins!Contact Form 7 How to load js and css only on specified pages.|WordPress

Learn how to make ContactForm7 js and css load only on specified pages in WordPress without using a plugin. Normally, when ContactForm7 is installed, js and css are loaded on every page, which slows down the display speed, but this...

Continue reading

Plant

What is a cactus. Origin and characteristics of ‘Cactos’ [1].

The word ‘Cactus’ derives from the Greek word ‘Kàktos’. The term was used by Theophrastus in his book HistoriaPlantarum to describe ‘unknown thorny plants’. The term ‘Cactus’ was subsequently adopted by the renowned botanist Linneo to define the American thorny...

Continue reading

Code Web Without Plugin Wordpress

Without Plugin!Easy copy and paste. how to add a site name shortcode to WordPress.

It is very time-consuming to rewrite site names when producing multiple sites. As a way of preventing this from happening, it is recommended to set up a system to call the name of the site by a shortcode. Write the...

Continue reading

Code Security Web Wordpress

How to hide information in php.ini.WordPress

Hiding php.ini information improves site security. You are encouraged to refer to this information to maintain your website. 1. Description in the ‘php.ini’ file.2. In “.htaccess” files. Description in the ‘php.ini’ file. display_errors = off In “.htaccess” files. <Files php.ini>...

Continue reading

Code Web Without Plugin Wordpress

Without plugins!Copy and paste, 3 minutes, super easy!How to implement dark mode.WordPress

Implement dark mode in WordPress.No plugin is required. 1. 1.JavaScript description.2. 2.Css description.3. 3.HTML description. 1.JavaScript description. Put the following js code in the header. document.addEventListener('DOMContentLoaded', function() { const toggleButtons = document.querySelectorAll('.toggle-mode'); toggleButtons.forEach(function(button) { button.addEventListener('click', function() { const currentMode =...

Continue reading

Speed Web Wordpress

How to optimise page speed in WordPress.WordPress

If a web page does not load within the first two seconds, 55% of mobile users will leave that web page. Furthermore, around 70% of consumers in online stores report that page display speed is linked to their willingness to...

Continue reading

Plant

Astrophytum asterias.

It is one of the cacti with the greatest number of persistent enthusiasts. Astrophytum asterias is particularly popular because of the large number of varieties and the ease of both hybridisation and seed production. The lack of thorns is considered...

Continue reading

Code Speed Web Without Plugin

Without Plugin!How to LazyLoad Google Adsense to speed up display speed.

Loading Google Adsense significantly reduces page display speed. The following methods will improve the expectation of problem resolution and should be tried. 1. Remove Script tag in Google Adsense code.2. Install code for LazyLoad. Remove Script tag in Google Adsense...

Continue reading

Emigration Environment

The sinking of Japan is real! Tokyo, Chiba, Saitama and Ibaraki are mostly sinking (Chiba becoming an island). Sapporo, Sendai, Nagoya, Osaka, Okinawa, etc. are also expected to sink. Antarctic ice (fresh water) will melt due to warming and boiling. Emigrate and move capital cities as soon as possible.

The world is now moving past ‘warming’ and into ‘boiling’. It is said that if the freshwater Antarctic ice melts away, sea level would rise by about 60 metres (the height of a 20-storey building), and simulations show that most...

Continue reading

Leave a Reply

This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.