taxonomy

Wordpress - taxonomy dropdown is not working with hierarchical

廉价感情. 提交于 2019-12-25 04:12:33
问题 Any hope to make this Taxonomy dropdown to work with hierarchical. I added 'hierarchical' => 1 but it seems doesn't work for me! <?php if( $terms = get_terms([ 'taxonomy' => 'category', 'hierarchical' => 1, 'hide_empty' => false, 'child_of' => 233 ]) ) : echo '<select name="categoryfilter4"><option>Downloads...</option>'; foreach ( $terms as $term ) : echo '<option value="' . $term->term_id . '">' . $term->name . '</option>'; // ID of the category as the value of an option endforeach; echo '<

Wordpress: Dynamically query/filter posts by taxonomy term_id

◇◆丶佛笑我妖孽 提交于 2019-12-25 01:42:04
问题 I have a walker to display terms of a taxonomy (see post here). It's a hierarchical list that is 3 levels deep: Taxonomy terms (number of posts incl. all sub levels) 1.1. subterms (number of posts incl. subsubterms 1 & 2) 1.1.1. subsubterms (number of posts) display post with Category "Subsubterms" 1.1.2 subsubterms (number of posts) display post with Category "Subsubterms" The terms display fine, but the posts on subsubterm-level do not display. The following code only displays post from the

Taxonomy list dependent on choice from another taxonomy list, drupal 8

别说谁变了你拦得住时间么 提交于 2019-12-24 21:21:06
问题 I have a taxonomy option list make where I choose say Toyota . I want the second taxonomy option list with the models of Toyota only (Eg. Corolla, hilux etc...). When I choose Benz the second list will then contains C-Class, ML, etc... I have created the entity vehicle from google examples on xampp localhost, windows 10. In my vehicle form I'm able to populate the first list. But the second appears empty. Here is my code. Please help: public function buildForm(array $form, FormStateInterface

get_page_by_title in Wordpress. How to use to fetch posts?

久未见 提交于 2019-12-24 06:34:04
问题 Recently, Wordpress added in the Trac that you can fetch posts by title using: get_page_by_title Instead of querying the database straight up. If I wanted to get post titled "my farm", how would I change the parameters so it is searching for a post (or a post type?): $page_title='Joey in the forest'; 'character' is a post type. But don't know how to work this. I assume the default return is the id, which would be $post->ID. Not sure what would be the equivalent if I use a post type. Thanks

Woocommerce: order by custom taxonomy

蓝咒 提交于 2019-12-24 02:07:38
问题 I'm having the following problem. I have set up a Wordpress site with WooCommerce to serve a webshop with only books. I have created some product attributes that are based on taxonomies like ' publisher ' and ' author ' (as multiple products can share an author or a publisher) I would like to be able to sort my products not only on the Woocommerce default fields like 'title' and 'price' but also on these taxonomy fields. Say for example: order by Author ASC or order by publisher DESC As far

WordPress - Add/Edit Post Screen Options not showing Categories

泪湿孤枕 提交于 2019-12-24 01:17:31
问题 this is hopefully a very simple fix but i just noticed on my Add New/Edit Post Screen Options i don't have Categories to Enable/Disable (see pic). Any help muchos appreciated!! 回答1: in wp-admin/includes/screen.php we see: <div class="metabox-prefs"> <?php meta_box_prefs( $this ); // draw checkboxes in screen options ?> </div> and meta_box_prefs function takes in account the get_hidden_meta_boxes function: function meta_box_prefs( $screen ) { global $wp_meta_boxes; $hidden = get_hidden_meta

Auto Categorization of Content

孤街浪徒 提交于 2019-12-22 09:55:17
问题 I'm developing a script that extracts the messages from the message archive of a particular meetup.com group of which I'm a member - http://www.meetup.com/opencoffee/messages/archive/ The idea is to dynamically add these to a wordpress site and allow people to search messages, auto tag messages etc. The issue I have is how best to auto categorize these messages. I would welcome any thoughts and ideas of how best to go about this and what would be the most efficient way of programming this.

Wordpress - Custom taxonomy page of custom post type listing by terms

允我心安 提交于 2019-12-21 09:26:10
问题 I have a taxonomy-taxonomy.php page that needs to look like so: CUSTOM POST TYPE TITLE (RESOURCES) Custom Taxonomy 1 (Resource Types) Resource Type Term 1 (White Papers) White Paper post 1 White Paper post 2 White Paper post 3 Resource Type Term 2 (Videos) Videos post 1 Videos post 2 Videos post 3 Tried to make sense of all the new documentation for Wordpress 3.0, but it only made me more confused as it seems to be mixed up with 2.8. 回答1: It's not necessary to transform the object to an array

Display current post custom taxonomy in WordPress

社会主义新天地 提交于 2019-12-20 09:45:24
问题 I've created custom taxonomies on WordPress and I want to display the current post taxonomies on the post in a list. I'm using the following code to display a custom taxonomy named "Job Discipline": <ul> <?php $args = array('taxonomy' => 'job_discipline'); ?> <?php $tax_menu_items = get_categories( $args ); foreach ( $tax_menu_items as $tax_menu_item ):?> <li> Job Discipline: <a href="<?php echo get_term_link($tax_menu_item,$tax_menu_item->taxonomy); ?>"> <?php echo $tax_menu_item->name; ?> <

rearrange a php array into a nested hierarchical array

怎甘沉沦 提交于 2019-12-20 03:52:15
问题 How can I transform array#1 into the array#2 structure using php ? The first Array is the results of a database query on a list of Organisms, each organism is classified with it's Order, Family, Genus, Species. Hierarchically Species are the child classifications of various Genus, and Genus classifications are child classifications of various Families etc . In namespace terms you could read it like so: item at index[ 0] ---> Hemiptera.Miridae.Kanakamiris item at index[ 1] ---> Hemiptera