Are taxonomy hierarchies possible?

I have run into similar problem with the system I am currently building – I needed ZIP codes to be children of Cities, which were to be children of States. What I have learned is that it was possible to add custom fields to the term creation form to link the term (e.g. ZIP) to … Read more

Get post terms with hierarchical relationships

I doubt you’re going to find a function that created the exact output you’re using, so you’re probably looking at two nested called to get_terms(). I usually avoid most other taxonomy-related plugins in favor of get terms. Most of the other functions are wrappers for this one. Here’s some psuedo-code for what I’d do: <?php … Read more

Apply custom names for generic custom taxonomy name?

Yes, that’s certainly possible, but you wouldn’t override anything- instead you’d fetch and add the custom names when they’re registered. For a quick example, say you have an option that stores the names: $taxonomies = array( ‘ingredient_1’ => ‘Toppings’, ‘ingredient_2’ => ‘Sauce’ ); add_option( ‘my_tax_names’, $taxonomies ); Then when you register the taxonomies: $taxonomies = … Read more

How can I add the custom taxonomy categories to the posts and pages?

All what you need to do is just pass required post types as array in the second parameter for register_taxonomy function call: add_action( ‘init’, ‘wpse8170_init’ ); function wpse8170_init() { register_taxonomy( ‘my-taxonomy’, array( ‘post’ ), array( … ) ); // or call this function if your taxonomy is already registered register_taxonomy_for_object_type( ‘my-taxonomy’, ‘page’ ); }

finding out the top 5 source ( source is a custom taxonomy ), in a given category

Thanks to some leads from the wp-hackers list on this very question and some googling around, here is the answer to my problem $sql = “SELECT count(*) as count,terms2.name as tag FROM wp_posts as p1 LEFT JOIN wp_term_relationships as r1 ON p1.ID = r1.object_ID LEFT JOIN wp_term_taxonomy as t1 ON r1.term_taxonomy_id = t1.term_taxonomy_id LEFT JOIN … Read more

Loop through multiple custom taxonomy terms and display posts for a custom post type

If you look at your var_dump, near the end, you will see the actual query being used. SELECT wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (93) ) AND wp_posts.post_type IN (‘post’, ‘page’, ‘attachment’) AND (wp_posts.post_status=”publish” OR wp_posts.post_author = 1 AND wp_posts.post_status=”private”) GROUP BY wp_posts.ID ORDER BY … Read more

Listing all custom post types using a specific term on the said term’s template page, in groups

Your code, when working, will consume sooo much resources. When implemented in this way – throught custom page template, WordPress will call for a content of that page (1 query) and after that it will call a query for each custom post type – another 4 queries. That’s a lot, really. I would suggest you … Read more

posting twice from an array?

You could try something like this: $postTitle=””; // save post title if(isset( $_POST[‘submit’])){ // if submit button is present $vergoeding=$_POST[‘vergoeding’]; $extrakosten=$_POST[‘extrakosten’]; for ($i=0; $i < count($vergoeding); $i++) { $new_post = array( ‘post_title’ => $postTitle, ‘post_content’ => ‘ ‘, // can not be empty ‘post_status’ => ‘publish’, ‘post_type’ => ‘landschapselement’ // custom post type ); $pid … Read more