/* Plugin Name: utilitist Simple Category List Description: List of product categories by name Version: 1.2 Author: Medicalebooks.org */ // Shortcode to display product categories in a simple list function utilitist_categories_list_shortcode($atts) { $args = array( 'taxonomy' => 'product_cat', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true, ); $categories = get_terms($args); if (!empty($categories) && !is_wp_error($categories)) { $output = '

Categories

'; // Add H2 header $output .= '
    '; foreach ($categories as $category) { $output .= sprintf( '
  1. %s
  2. ', esc_url(get_term_link($category)), esc_html($category->name) ); } $output .= '
'; } else { $output = '

No categories found.

'; } return $output; } // Register the shortcode add_shortcode('utilitist_categories_list', 'utilitist_categories_list_shortcode'); // Add styles function utilitist_categories_list_styles() { echo ' '; } add_action('wp_head', 'utilitist_categories_list_styles'); ?>