php - How can i get all values of particular attribute in woocommerce, It shows invalid_taxonomy in WP_ERROR_OBJECT -
i m new in wordpress, set e-book store of woocommerce, want add custom shortcode in woocommerce plugin fetch list of publishers , display alphabatically. publisher custom attribute of simple product. did
$shortcodes = array( 'product' => __class__ . '::product', 'product_page' => __class__ . '::product_page', 'product_category' => __class__ . '::product_category', 'product_categories' => __class__ . '::product_categories', 'add_to_cart' => __class__ . '::product_add_to_cart', 'add_to_cart_url' => __class__ . '::product_add_to_cart_url', 'products' => __class__ . '::products', 'recent_products' => __class__ . '::recent_products', 'sale_products' => __class__ . '::sale_products', 'best_selling_products' => __class__ . '::best_selling_products', 'top_rated_products' => __class__ . '::top_rated_products', 'featured_products' => __class__ . '::featured_products', 'product_attribute' => __class__ . '::product_attribute', 'related_products' => __class__ . '::related_products', 'shop_messages' => __class__ . '::shop_messages', 'woocommerce_order_tracking' => __class__ . '::order_tracking', 'woocommerce_cart' => __class__ . '::cart', 'woocommerce_checkout' => __class__ . '::checkout', 'woocommerce_my_account' => __class__ . '::my_account', 'woocommerce_publishers' => __class__ . '::publishers', );
publisher function
public static function publishers(){ $args = array( 'posts_per_page' => 3,'posts_type' =>'product','post_status' =>'publish'); $lastposts = get_posts( $args ); foreach ( $lastposts $post ) :setup_postdata( $post ); $prod_id = get_the_id(); $terms = get_the_terms($prod_id, 'pa_publisher' ); print_r($terms); endforeach; wp_reset_postdata(); } }
after m not getting results, want know how publisher names in alphabetic order. after execute above code returns error
wp_error object ( [errors] => array ( [invalid_taxonomy] => array ( [0] => invalid taxonomy ) ) [error_data] => array ( ) )
help me plzz.. in advance
Comments
Post a Comment