Articles of custom taxonomy

Combining custom post type and post category

How can I query all the posts from either the custom post type (‘videos’) or with a post category (‘video’) in a loop? I’ve managed to create a query that combines the posts from a custom post type and the normal posts using the code below, but am struggling with achieving the same with a […]

How to order a list of taxonomy terms alphabetically?

I have the following code to list taxonomy terms in a drop down list. It works great, except the list in the drop down isn’t in alphabetical order. How do I modify the code to list them alphabetically? <form action=”<?php bloginfo(‘url’); ?>/” method=”get”> <?php $term_id = 279; $taxonomy_name = ‘categories’; $termchildren = get_term_children( $term_id, $taxonomy_name […]

How to get the top most term (top ancestor) of a custom taxonomy child term?

I need to get the topmost term (top level ancestor) of a taxonomy term. Suppose the following term hierarchy: North America United States New York New York City South America Mexico I need to get the ID of “North America” term if I know the ID of “New York” I’m using an adapted function found […]

How to get posts from multiple custom post types according to it's custom taxonomy terms?

I have two custom post types and separate taxonomies for each. post type – dramas ——— taxonomy – drama_taxonomy post type – reality_shows — taxonomy – reality_shows_taxonomy For now I am displaying posts of dramas post type on a page where it is displayed under it’s term name. the code : <?php //fetching the terms […]

How to include parent terms in hierarchical taxonomy URLs?

For all custom taxonomies, the URLs look like: /base/slug/. I need a solution to for my hierarchical taxonomies to have: /base/parentslug/childslug/. Anybody knows how to redirect and or to have the same functionality like categories?

Require a Custom Taxonomy to be checked

I have a custom taxonomy, “position”, with multiple terms for a custom post type, “employee” in the admin. I want to validate the form to require a position to be selected when you save/update a post. How do I validate and make the position custom taxonomy a required field in the wordpress admin? Also, I’d […]

Custom Taxonomies Incorrectly Counting Revisions?

(Moderator’s note: The original title was “The count of my custom taxonomy is incorrect; it’s counting revisions”) Has anybody run into this before? I’ve added two custom taxonomies, and the count column of the wp_term_taxonomy table is being set incorrectly. It appears to be counting revisions in addition to the published post. I’ve poked around […]

Creating a custom Admin panel

I’m building a WordPress Plugin and it has two tables and some data. Right now, for displaying and changing the data, I’m using the wpdb function and manually creating the user interface (mimicking the Default one). However, I see that other plugins have a more consistent style with their tables and the same features (like […]

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 […]