Product categories WordPress codex
How to get current product category slug?
global $wp_query; echo $wp_query->query_vars['product_cat'];
How to get current product category slug?
global $wp_query; echo $wp_query->query_vars['product_cat'];
Hi guys, I have this problem during my WordPress coding journey. The `get_the_ID()` has conflict in nested `WP_Query` codes. On the first `WP_Query` loop, the ID for example is 20, then inside that loop I have another `WP_Query` (see the codes below) that makes the `WP_Query` codex more completed if you don’t code it right….
How to style your radio button? Using simple CSS, you can do whatever styles in your radio button (<input type=”radio” value=”my radio button” />). Try this code your own. Output: my radio button my radio button input[type=radio] { -webkit-appearance: textfield; background: green; border: 5px solid #000; padding: 7px; border-radius: 50%; } input[type=radio]:checked { background: red;…
This plugin hasn’t been tested with the latest major releases of WordPress is showed up to my WordPress plugin after I did not update my WordPress plugins for a year I think or months and many WordPress version is released after that. This is the exact notice message displayed: This plugin hasn’t been tested with…
Theme my login (TML) or WordPress login form does not show the login error. This error display after you have login the wrong username or password. The reason why it is not showing is the current login form action URL and your current page has different URL. Theme my login (TML) is using /login/ page…
This code is showing how to add a archive-child/archive-parent classes in Woocommerce product category pages using display_type option. add_filter( ‘body_class’, function( $classes ){ $object = get_queried_object(); if( get_woocommerce_term_meta( $object->term_id, ‘display_type’, true ) != ‘subcategories’ ){ $classes[] = ‘archive-child’; }else{ $classes[] = ‘archive-parent’; } return $classes; });
How to get the category ID of the current post? Just copy the codes below and paste it into your .php file. $category = get_the_category( get_the_ID() ); $category_ID = $category[0]->term_id; Another problem is, what if the category ID is a sub category and you need the parent category ID? For Example, the current category ID…