taxonomy

Check if term exists and create a node with rules

邮差的信 提交于 2019-12-02 10:08:32
问题 I actually have 2 questions regarding Drupal 7 and Rules.: How to check if a term exists with rules How to make a new node and forward to the node entry with rules Let me sketch the scenario first and then explain in more detail: Im currently creating a simple stock program to be used with a barcode scanner. The barcodes are stored in a taxonomy tree. I have 2 content types, a scan and a product. A user is always presented with the scan content type (one big text input) that the barcode

Check if term exists and create a node with rules

我是研究僧i 提交于 2019-12-02 05:20:57
I actually have 2 questions regarding Drupal 7 and Rules.: How to check if a term exists with rules How to make a new node and forward to the node entry with rules Let me sketch the scenario first and then explain in more detail: Im currently creating a simple stock program to be used with a barcode scanner. The barcodes are stored in a taxonomy tree. I have 2 content types, a scan and a product. A user is always presented with the scan content type (one big text input) that the barcode scanner will fill in and submit. Drupal then checks to see if the scanned barcode is present in the taxonomy

Creating Drupal taxonomy terms from code?

不想你离开。 提交于 2019-12-01 13:48:55
What is the function used to create taxonomy terms in Drupal from the code? Why don't check the API docs? The answer is right there. http://api.drupal.org/api/function/taxonomy_save_term/6 A module I was writing needed a specific vocabulary with hierarchical terms. I wrote this function to save the terms: <?php /** * Save recursive array of terms for a vocabulary. * * Example: * <code><?php * $terms = array( * 'Species' => array( * 'Dog', * 'Cat', * 'Bird' ), * 'Sex' => array( * 'Male', * 'Female' ) ) * _save_terms_recursive( $vid, $terms ); * </code> * * @param int $vid Vocabulary id * @param

List categories by author ~ WITH COUNTER ~ (Wordpress)

半城伤御伤魂 提交于 2019-12-01 13:43:00
This is the code that I've got. It gives a list of the categories a given author has published in. However, I would very much like to have a number next to the category name, telling how many posts the author has published in the different categories. Anyone knows a trick? Thanks! <?php $author = get_query_var('author'); $categories = $wpdb->get_results(" SELECT DISTINCT(terms.term_id) as ID, terms.name, terms.slug, tax.description FROM $wpdb->posts as posts LEFT JOIN $wpdb->term_relationships as relationships ON posts.ID = relationships.object_ID LEFT JOIN $wpdb->term_taxonomy as tax ON

getting custom taxonomies terms of a post

China☆狼群 提交于 2019-12-01 13:15:40
问题 I am trying to get print names of custom taxonomy that i have created for products. function create_product_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' => _x('product_categories', 'taxonomy general name'), 'singular_name' => _x('Product', 'taxonomy singular name'), 'search_items' => __('Search Product Category'), 'all_items' => __('All Product Categorie(s)'), 'parent_item' => __('Parent Product Category'), 'parent_item_colon' => __(

List categories by author ~ WITH COUNTER ~ (Wordpress)

故事扮演 提交于 2019-12-01 12:04:40
问题 This is the code that I've got. It gives a list of the categories a given author has published in. However, I would very much like to have a number next to the category name, telling how many posts the author has published in the different categories. Anyone knows a trick? Thanks! <?php $author = get_query_var('author'); $categories = $wpdb->get_results(" SELECT DISTINCT(terms.term_id) as ID, terms.name, terms.slug, tax.description FROM $wpdb->posts as posts LEFT JOIN $wpdb->term

wordpress custom post category filter

允我心安 提交于 2019-12-01 12:00:20
I'm trying to display only certain categories for a custom post called portfolio in my portfolio template page. I am amble to display only 1 category by the slug but I need to display more than 1 and I'll like to know if there's a way to filter the categories by their ID. CODE global $wp_query; $portfolio_items = $sd_data['portfolio_items']; // Get Items per Page Value $paged = get_query_var('paged') ? get_query_var('paged') : 1; $args = array( 'post_type' => 'portfolio', 'posts_per_page' => $portfolio_items, 'post_status' => 'publish', 'orderby' => 'date', 'paged' => $paged ); // Only pull

Custom taxonomy - setting access based on role or capability

99封情书 提交于 2019-12-01 01:15:49
I am only just learning about custom taxonomies for Wordpress. How is it possible to restrict access for my users to use a taxonomy. For instance, I have created a taxonomy named featured and I only want Editors and above roles to be able to add posts to this taxonomy. How do I set the access level? Either based on user role or capability, both works for me. Here is the code that I use for my taxonomy: function add_custom_taxonomies() { // Add new "Featured" taxonomy to Posts register_taxonomy('featured', 'post', array( // Hierarchical taxonomy (like categories) 'hierarchical' => true, // This

What's a learning curve and why is steep not hard?

百般思念 提交于 2019-11-30 06:38:28
What exactly is a learning curve? And why is it wrong to use the term "steep learning curve" for something which has high entry barriers and takes quite some time to get into? As to the why-ness of this question: The terms are used often and inconsistently on Stack Overflow I myself have been confused by it Mostly the newbies are confronted with these terms when they for example ask questions like "what's the best php development framework" It's a curve of time versus proficiency. Steep for hard is wrong because it'd mean that you get very proficient in very little time proficiency | __ | | |

What's a learning curve and why is steep not hard?

≯℡__Kan透↙ 提交于 2019-11-29 06:15:44
问题 What exactly is a learning curve? And why is it wrong to use the term "steep learning curve" for something which has high entry barriers and takes quite some time to get into? As to the why-ness of this question: The terms are used often and inconsistently on Stack Overflow I myself have been confused by it Mostly the newbies are confronted with these terms when they for example ask questions like "what's the best php development framework" 回答1: It's a curve of time versus proficiency. Steep