How can I populate a select element with terms from a custom taxonomy and filter post results?

Are you familiar with jQuery? You’ll want to post the term to a admin-ajax, and use the response to populate the second select. Here is the codex documentation: http://codex.wordpress.org/AJAX_in_Plugins A loose example for your situation: $first_term = $(‘#states’); $name = $first_term.children(‘option:selected’).text(); var data = { action: ‘tag_slug’, slug: $slug }; var ajaxurl=”wp-admin/admin-ajax.php”; $.post(ajaxurl, data, function(response) … Read more

Using default WP menu functionality to link to custom post-type listing?

Your best bet if you want them to show using the default drag and drop function is to register a custom taxonomy for the custom post type, http://codex.wordpress.org/Function_Reference/register_taxonomy. You can also use the taxonomies parameter when you register your CPT function. http://codex.wordpress.org/Function_Reference/register_post_type The alternative is to make a custom filter for your nav menu that … Read more

Customising the search function?

You can use pre_get_posts hoot to filter the search query to selected sectors only, something like this: function Search_with_in_a_tax( &$query ) { if ( is_search() && isset($_GET[‘sector_array’])) { $tax_query = array( array( ‘taxonomy’ => ‘news’, ‘terms’ => $_GET[‘sector_array’], ‘field’ => ‘term_id’, ) ); //turn it into a WP_Tax_Query object $tax_query = new WP_Tax_Query($tax_query); $query->set(“tax_query”, $tax_query); … Read more

List taxonomy term “Last Name” + “First Name” (taxonomy custom field) in a post loop

So I decided to go another way. I now have the Author’s Full Name as terms in the taxonomy. For the index, for which I need to separate Last Name and First Name, I used PHP string functions. <?php $taxonomy = ‘autores’; $queried_term = get_query_var($taxonomy); $terms = get_terms($taxonomy, ‘slug=’.$queried_term); if ($terms) { echo ‘<div id=”indiceAutores-nav”></div> … Read more

is_taxonomy is deprecated. What’s the alternative?

See Codex page for is_taxonomy This function is deprecated as of Version 3.0. Please use taxonomy_exists instead. wp_insert_term uses taxonomy_exists to check if the taxonomy exists. This means if the taxonomy is a registered taxonomy. (It would be odd if wp_insert_term only you allowed to add a term to taxonomies with existing terms 🙂 ) … Read more

Set attachment tags from attachment’s custom field data

I managed to make it work but not fully. First, the code you provided is not retrieving an already saved post_meta. I based my code in the introductory code of this tutorial: http://wpengineer.com/2076/add-custom-field-attachment-in-wordpress/ And am using the regular post_tag taxonomy instead of a custom one. And, lastly, there’s a bug, after you close the Media … Read more

Displaying terms based on loop posts?

I think you can try the following options. wp_list_categories with the ‘show_count’ parameter http://codex.wordpress.org/Template_Tags/wp_list_categories get category and use $count = $category->category_count; http://codex.wordpress.org/Function_Reference/get_category You can traverse up the functions to get_term if those don’t work and see what is in there, even though you probably can use get the terms you will have to parse the … Read more

category filter doesn’t work in WPML

First you should upgrade WPML to the latest version, which is 2.4.3 at time of writing. To properly translate categories you should start by editing the category of the default language. Once you are in that screen (wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=x&post_type=post where x is the category ID), you will see at the bottom a metabox titled Language. This … Read more