Articles of custom taxonomy

How to customize admin posts based on the user who is logged in

We are building a site that will have 10-15 photographers posting content. There will be a common blog + each admin has their own portfolio to manage. “Portfolio galleries” and “portfolio pages” are two custom types and they are categorized using “Artist”, a custom taxonomy. We would like all admins: to be able to see […]

get_terms() doesn't return empty terms even though hide_empty is false

I can’t manage to make get_terms() to return the empty terms and I’ve tried it in a number of ways. Here’s the code: $terms = get_terms(‘device’,array(‘hide_empty’ => 0)); foreach($terms as $term) { if($term->parent == 0) { if($i++ != 0) echo ‘</optgroup>’; echo ‘<optgroup label=”‘.$term->name.'”>’; $id = $term->term_id; $args = array(“child_of”=>$id); $this_term = get_terms(‘device’,$args); foreach($this_term as […]

Generate Shortcodes by Taxonomy

Check this code: function slide_group() { register_taxonomy(‘Group’, ‘slides’, array( ‘hierarchical’ => true /*visualizza come le categorie*/, ‘label’ => ‘Group’, ‘query_var’ => true, ‘rewrite’ => true));} add_action(‘init’, ‘slide_group’, 0); function square_slider_template() { // Query Arguments $args = array( ‘post_type’ => ‘slides’, ‘posts_per_page’ => 5 ); // The Query $the_query = new WP_Query( $args ); // Check […]

wp_query orderby title and meta key value (WP3.1)

I have a taxonomy wp_query and i would like to order the list by title and by meta value (numeric value) Have a meta value Interesting = 1 or 0 in the posts Not so interesting posts would be at the bottom of the query GOAL – OUTPUT LIKE THIS: (is this possible with WP_QUERY […]

Menu Multiple Taxonomies

I have a post_type “products” which has both “Category” and “Brand” taxonomies. Each product has exactly 1 Category, and exactly 1 Brand. I would like to display a menu which first lists the Categories as the top-level menu, and then lists the Brands contained in each as a Sub-Menu. Each Sub-Menu should only display the […]

Is it acceptable to build functionality into a theme built for a client?

I know it’s now the common wisdom to not build functionality into themes, as advised by WordPress, Envato, and others. This includes the likes of content types, taxonomies, sliders, shortcodes etc, to make themes as flexible as possible when used for different applications. I know I don’t like downloading themes which have more functionality built-in […]

How to Query Database for posts with certain Taxonomy Term

I want to write a select query to return data on only posts which have are associated with the taxonomy term food-and-beverage SELECT wp_postmeta . * , wp_posts.post_name FROM wp_posts, wp_postmeta, wp_terms, wp_term_relationships WHERE wp_posts.post_type = ‘projects’ AND wp_posts.post_status = ‘publish’ AND wp_posts.ID = wp_postmeta.post_id AND wp_term_relationships.object_id = wp_posts.ID AND wp_term_relationships.term_taxonomy_id = wp_terms.term_id AND wp_terms.slug […]

Including all terms in wordpress tax_query

I’m a little bit confused, why I can’t include all the terms in tax_query automatically? My code: ‘tax_query’ => array( array( ‘taxonomy’ => ‘city’, ‘field’ => ‘slug’, ‘terms’ => array( nyc, boston, london ), ) ) What If I’ve dozens of cities? Isn’t it uncool to add them all manually?

Get current term's ID

Im using the following code to get an array of children taxonomies and write them out with links in an unordered list. <?php $termID = 10; $taxonomyName = “products”; $termchildren = get_term_children( $termID, $taxonomyName ); echo ‘<ul>’; foreach ($termchildren as $child) { $term = get_term_by( ‘id’, $child, $taxonomyName ); echo ‘<li><a href=”‘ . get_term_link( $term->name, […]

How-to leverage WordPress for creating Extended Social Profiles

My question is actually quite simple, but I think there are a number of answers to choose from: If one were to use WordPress, what would be the most elegant way of creating a part of the website that has “People Profiles”, whereby; they can update their own mini-blog, add images, assign them a multitude […]