This document has notes related with Javascript Promises and Async Programming
- Async Programming
- Consuming and creating promises
- Async Await
<?php | |
// Print term slug | |
$terms = get_the_terms( $post->ID , 'oil' ); | |
if ( $terms != null ){ | |
foreach( $terms as $term ) { | |
print $term->slug ; | |
unset($term); | |
} } | |
// Get term title |
/* | |
Make sure you execute the script in the right database! | |
- Delete all products - | |
Description: This script deletes all WooCommerce products | |
and their associations (categories/taxonomies and terms info) | |
*/ | |
DELETE relations.*, taxes.*, terms.* |
<?php | |
$books["978"] = "Jjaj"; | |
$books["978"] = "The Pepe"; | |
$books["978"] = "Jackie's Fables"; | |
$books["978"] = "Mahabhartazaa"; | |
?><html> | |
<head> |
<?php | |
// function can be placed in functions.php and then you can use on template files | |
// the following function, passing the ID of parent category | |
woocommerce_subcats_from_parentcat_by_ID($parent_cat_ID); | |
function woocommerce_subcats_from_parentcat_by_ID($parent_cat_ID) { | |
// custom parameters | |
$args = array( |
<?php | |
// this function can be used anyplace on your template and will show full size featured images of taxonomy terms, | |
// replace $term_id with the right ID and enjoy your life. | |
$term_id = 37; | |
$taxonomy = 'product_cat'; | |
// Get subcategories of the current category | |
$terms = get_terms([ |
<?php | |
// intended to be placed in short-description on the single product page | |
global $post, $product; | |
$id = $product->id; | |
$categories = get_the_terms( $product->get_id(), 'product_cat' ); | |
$firstlevelcategories = []; | |
$secondlevelcategories = []; | |
<?php | |
// first query | |
$first_ids = get_posts( array( | |
'post_status'=> 'publish', | |
'orderby' => 'date', | |
'post_type'=> 'press', | |
'posts_per_page' => -1, | |
'order' => 'DESC', | |
)); |