Skip to content

Instantly share code, notes, and snippets.

@jstneti01
jstneti01 / author.php
Created January 19, 2017 06:41
WordPress User Taxonomy
<?php
get_header();
$curauth = (get_query_var( 'author_name' )) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );
$userid = $curauth->ID;
$org_terms = wp_get_object_terms( $userid, 'user_cat' );
$position = '';
if ( ! empty( $org_terms ) ) {
if ( ! is_wp_error( $org_terms ) ) {
foreach ( $org_terms as $org_term ) {
@jstneti01
jstneti01 / archive-product.php
Created January 15, 2017 15:06
Example of how to create a taxonomy dropdown filtered by WooCommerce Product Category we are currently on.
<?php
//Put this code in your child theme inside the woocommerce folder or add it with a filter.
// Get currenty category ID
$cat_id = get_queried_object_id();
// Get Location terms filtered by Product Category of this page.
$post_ids = get_objects_in_term( $cat_id, 'product_cat' ); // WooCommerce default category
$terms = wp_get_object_terms( $post_ids, 'location' ); // Custom Taxonomy for WooCommerce Products
@jstneti01
jstneti01 / 0_reuse_code.js
Created October 4, 2016 19:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console