Skip to content

Instantly share code, notes, and snippets.

View amouratoglou's full-sized avatar
🤗

Agustin Mouratoglou amouratoglou

🤗
View GitHub Profile
@amouratoglou
amouratoglou / wordpress_taxonomy_term_title_and_slug
Last active August 19, 2019 02:31
Wordpress Show Taxonomy Term Title and Slug inside loop #wordpress
<?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
@amouratoglou
amouratoglou / woocommerce_sql_scripts.sql
Last active September 11, 2019 15:27
Woocommerce product management SQL scripts
/*
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.*
@amouratoglou
amouratoglou / array-key-value-foreach.php
Created November 24, 2019 01:25
Output array key and value foreach loop php
<?php
$books["978"] = "Jjaj";
$books["978"] = "The Pepe";
$books["978"] = "Jackie's Fables";
$books["978"] = "Mahabhartazaa";
?><html>
<head>
@amouratoglou
amouratoglou / javascript-promises-and-async.md
Last active February 8, 2020 18:38
Javascript Promises and Async Programming

Introduction

This document has notes related with Javascript Promises and Async Programming

Promises in Javascript

  • Async Programming
  • Consuming and creating promises
  • Async Await
@amouratoglou
amouratoglou / function_query_woocommerce_subcategory_thumbnail_featured_image.php
Last active June 1, 2020 22:24
Wp Woocommerce Subcategory Loop showing featured image in tumbnail size
@amouratoglou
amouratoglou / woocommerce-taxonomy-term-list-with-featured-image-for-loop.php
Last active June 1, 2020 22:28
Woocommerce Taxonomy Term list with featued image for loop
@amouratoglou
amouratoglou / woocommerce_current_product_categories_and_child.php
Last active September 21, 2021 01:43
woocommerce get all current product parent and child categories
<?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 = [];
@amouratoglou
amouratoglou / 1_stripe-schema.md
Created December 5, 2021 15:28 — forked from FGRibreau/1_stripe-schema.md
Stripe database schema (extracted from their sigma product) as of 2019-10-09
jqn -r markdown-table 'map(x => "## " + x.name + "\n\n" + markdownTable(x.columns.map(y => [y.name, y.type]))  ) | join("\n\n")' < /tmp/stripe.json

accounts

id varchar
business_name varchar
business_url varchar
@amouratoglou
amouratoglou / wp-combine-two-arrays-post-types-re-order-and-render.php
Last active December 13, 2021 20:38
Wordpress PHP Combine two wp queries of different post types - merge 2 arrays and sort by date
<?php
// first query
$first_ids = get_posts( array(
'post_status'=> 'publish',
'orderby' => 'date',
'post_type'=> 'press',
'posts_per_page' => -1,
'order' => 'DESC',
));