display taxonomy slug from term ID
You can use get_term_by() for this <?php $term_id = array_pop(get_sub_field(‘sector_selector’)); $catinfo = get_term_by( ‘id’, $term_id, ‘name_of_the_taxonomy’ ); print $catinfo->slug;
You can use get_term_by() for this <?php $term_id = array_pop(get_sub_field(‘sector_selector’)); $catinfo = get_term_by( ‘id’, $term_id, ‘name_of_the_taxonomy’ ); print $catinfo->slug;
You might be able to accomplish this using Advanced Custom Fields: http://www.advancedcustomfields.com/resources/taxonomy/ Field groups, like the taxonomy field, can be assigned to templates. Editing the taxonomy archive page, the user would see checkboxes (or radio buttons, or a select menu) for the taxonomy terms. In the corresponding “taxonomy archive” template (from link above)… <?php $terms … Read more
My bad – the mark up for the edit page is different than add. Used this instead add_action(‘provider_edit_form_fields’, array($this, ‘category_metabox_edit’), 10, 1); // add image field in edit form function category_metabox_edit($tag) { $term_val = get_term_meta($tag->term_id, ‘show_on_provider’, true); $term_val == 1 ? $checked = ‘checked’ : $checked = ”; echo ‘<tr class=”form-field”> <th scope=”row” valign=”top”><label for=”show_on_provider”>’ … Read more
Thanks to @ialocin in his comment above, I took his recommendation and adapted it to fit my needs. Traversing the taxonomy hierarchy from the bottom up is actually relatively simple if you understand how WordPress does this from the top down. function origin_trail_ancestor($cat_id = 0, $link = false, $trail = false) { global $wp_query; $anchor … Read more
Unluckily does not exist a clean way to do this, because register taxonomy doesn’t provide a menu_order argument. But you can act on global $submenu variable and reorder it, something like add_action( ‘admin_menu’, function() { global $submenu; $found = FALSE; $before = $after = array(); $tax_slug = ‘my_custom_tax’; // change your taxonomy name here foreach … Read more
In all honesty, I really think that all your misery is caused by your pagination function as we have briefly discussed a while ago. You do have a couple of issues here that are contributing factor to the problems you are experiencing Changing the main query for a custom query for what ever reason is … Read more
$albumGenres = get_the_terms( $post->ID, ‘discography_album_label’ ); foreach ( $albumGenres as $albumGenre ) { echo $albumGenre->name; // or whatever value }
Yes it is possible. One part of my question is answered here and full code I will type here. I have larger function wich checkes post taxanomy (in this case custom categories for custom post type). Then we check is there particular taxonomy and we change URL structure. add_filter(‘post_type_link’, ‘replace_link’, 1, 3); function replace_link( $link, … Read more
You can use the parent argument in get_terms() to get direct children of a term. You can use the child_of argument to get all descendents of a term. Something like this. $parent_id = 32; $args = array( ‘parent’ => $parent_id ); $terms = get_terms( $taxonomy, $args ); print_r( $terms ); If you want to programmatically … Read more
Your “Nutrition plan” post type should use the Repeater Field from ACF: http://www.advancedcustomfields.com/add-ons/repeater-field/ Inside this Repeater Field you have to use “Post Object” filtering only your “Recipes” post type: http://www.advancedcustomfields.com/resources/post-object/