taxonomy

Get Woocommerce Category Thumbnails

谁都会走 提交于 2020-11-30 07:36:11
问题 I have a custom template for a woocommerce category page to only display the categories. I have got the system to get a list of the child categories (by using get_term_children($id, 'product_cat') and get_term_by(...) ), but it only returns objects containing all the required information, except the thumbnail data. Does anyone know how I can get the thumbnail for the term? 回答1: Sorted it, here's the code I used: $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );

Output taxonomy term names for translations

爷,独闯天下 提交于 2020-07-22 22:43:53
问题 I'm currently outputting the term id's for several languages on a page. How can I output the term names for each instead? I've tried to use the get_term function to specifically get the French name for the taxonomy term and it still comes out in English even though the ID is the French id. Where am I going wrong? <?php $taxonomy = "categories"; $terms = get_terms( array( 'suppress_filters' => false, 'taxonomy' => $taxonomy, 'hide_empty' => false, ) ); if ($terms) { foreach ($terms as $term )

WooCommerce display product categories in product title

£可爱£侵袭症+ 提交于 2020-07-19 12:00:21
问题 I have a Wordpress (version 4.2.2) eCommerce site running WooCommerce (version 2.3.8). On my individual product page I wish to set the title of the product to also include the custom categories I have created in WooCommerce and that this product belongs to. I find the following file (wp-content/themes/mytheme/woocommerce/single-product/title.php) that relates to the title of the individual product and edit it as below to try and include the categories that this product belongs to in the title

Post to remote WordPress site with custom taxonomy

倾然丶 夕夏残阳落幕 提交于 2020-05-17 07:54:26
问题 I'm using this code to push data to a custom post type of a remote website: $api_response = wp_remote_post( 'https://example.com/wp-json/wp/v2/clothing_line', array( 'headers' => array( 'Authorization' => 'Basic ' . base64_encode( 'admin:5mMcJGUGNFYq9PxU5P0ad0Np' ) ), 'body' => array( 'title' => 'Pink Shirt', 'status' => 'publish', 'post_type' => 'clothes', 'categories' => 2, 'slug' => 'pink-shirt', 'meta' => array('amount' => '12.50', 'style' => 'petite', 'size' => 'small', 'gender' =>

Get all posts from custom taxonomy in Wordpress

怎甘沉沦 提交于 2020-02-17 06:42:25
问题 Is there a way to get all the posts from a taxonomy in Wordpress ? In taxonomy.php , I have this code that gets the posts from the term related to the current term. $current_query = $wp_query->query_vars; query_posts( array( $current_query['taxonomy'] => $current_query['term'], 'showposts' => 10 ) ); I'd like to create a page with all the posts in the taxonomy, regardless of the term. Is there a simple way to do this, or do I have to query the taxonomy for the terms, then loop trough them,

PHP Wordpress code echo's slug not term?

允我心安 提交于 2020-01-06 19:10:44
问题 Does anybody know how I can change the below code for my custom taxonomy (created in the Magic Fields 2 plugin) to solve my problem. I would like it to echo the name of the selected value rather than slug format. e.g. I'd like to echo Client 1 and Client 2 instead of client-1 and client-2 as it currently does. I'd like to display multiword names with spaces and correct capitalisation e.g. Joe Bloggs Associates not joe-bloggs-associates . project_statistics_client is the name of the field

Query multiple taxonomies group slugs

你说的曾经没有我的故事 提交于 2020-01-06 18:10:55
问题 I have a checkbox function that I'm using for my search query. My problem is the url created when I search. ?ct_zipcode=&ct_event_type=birthday&ct_event_type=photovideo-shoot&Venue-search=true When I have multiple taxonomy_names checked I only get the last slug in my search results. I need my url to be rewritten like: ?ct_zipcode=&ct_event_type=birthday%2Cphotovideo-shoot&Venue-search=true Is there an easy way to change my url with rewrite? I've tried a little str_replace / preg_replace with