Skip to content

Instantly share code, notes, and snippets.

@kloon
Created October 17, 2013 07:10
Show Gist options
  • Save kloon/7020377 to your computer and use it in GitHub Desktop.
Save kloon/7020377 to your computer and use it in GitHub Desktop.
List all vendors shortcode
add_shortcode( 'list_vendors', 'wc_list_vendors_shortcode' );
function wc_list_vendors_shortcode( $atts ) {
$vendors = '';
$terms = get_terms( 'shop_vendor' );
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, 'shop_vendor' );
if ( is_wp_error( $term_link ) )
continue;
$vendors .= '<h2><a href="' . $term_link . '">' . $term->name . '</a></h2>';
}
return $vendors;
}
@vexsoluciones
Copy link

after i post this script at the end of my function file it gives this error

Warning: Cannot modify header information - headers already sent by (output started at wp-content/themes/themename/functions.php:260) in /home/themename/public_html/wp-content/plugins/woocommerce/classes/class-wc-session-handler.php on line 63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment