Support

Account

Home Forums Search Search Results for 'taxonomy'

Search Results for 'taxonomy'

topic

  • Helping

    Show A Default Field Group on New Post Page

    Hello,

    I was able to set a default post taxonomy but it does not show the ACF Field group until I manually click on it to change it. Can you provide any insight? I think I would need to trigger an event by javascript to show but I am not sure how to do that.

    To clarify, I have three post taxonomies: TBL, FBL and College. The location rules in ACF are to show depending on which taxonomy is selected. I have set a default to TBL but even though it is selected as default and checked the ACF Field Group Box for TBL does not show until I click on another option and back on TBL. I would like the TBL field box to show on page load.

    Eventually, I would like it to show the ACF field box for the last selected option be it TBL, FBL or College on page load.

    Thank you for your help in advance and great plugin by the way!

    David

  • Solved

    Need a solution for a single True/False Field to set a stored taxonomy term

    I need a solution to provide a single True/False field with the ability to activate a special taxomy term in the backend of a custom post type entry.
    Thanks in advance for any help!

  • Unread

    Can’t filter by custom media taxonomy in editor

    I successfully used ACF custom taxonomies to add Media categories. I added the dropdown filter via functions.php to the Media Library and can sort items while I’m in the Media Library. But I don’t know how to add this dropdown to the Select or Upload Media modal so I can filter images by category when adding images in a post or page. Is this even possible to do? If it is, can someone point me in the right direction or documentation for this?

  • Unread

    ACF Post Field and Taxonomy Issue

    Hello, I’ve got a teaser snippet that pulls the taxonomy info for a custom post type and works fine when using a wpquery:

    setup_postdata($post);
    $postid = $post->ID;
    $item_image = get_field("listing_image", $post->ID);
    
        // TAXONOMY //
        $taxonomy = 'types';
        $terms = get_object_term_cache( $postid, $taxonomy );
        $outputpill = '';
        $i = 1;
    
        $teasertype = '';
        foreach($terms as $term) {
            if ($i == 2) { break; }
        if(!empty($outputpill))
            $outputpill .= '';
            $outputpill .= '<div class="cat cat-pill pill-'. $term->slug . '">'.$term->name.'</div>';
            $teasertype = $term->slug;{}
            $i++;
       
        }
    
        // BUTTON SWITCH //
        if($teasertype){
        switch($teasertype){  
            case 'article':
                $ctaclass= "article";
                $ctatext= "Read Now";
    
    etc etc etc 

    When I use this snippet on another page that references these custom post types using a Post Object field, it throws an error when looking up the taxonomy:

    Warning
    : foreach() argument must be of type array|object, bool given in
    /Users/louis.plante/Local Sites/smartvaultcom/app/public/wp-content/themes/smartvault-wordpress-website/inc/snippets/_incl_resources–teaser.php
    on line
    17

    Code used:

    									<?php $post_objects = get_field('campaign_group1_item_resource'); ?>
    									<?php
    									if( $post_objects ):
    									foreach( $post_objects as $post): 
    										setup_postdata($post); //set new $post_object
    										get_template_part( 'inc/snippets/_incl_resources--teaser' );
    									endforeach;
    									wp_reset_postdata(); //reset global $post
    									endif;
    									?>
  • Unread

    Google Maps Displaying in Elementor

    Hi there! I’m not a developer, just a Dad that is trying to create a cool website for his Jazz Musician son. While I’m using Elementor, I’m also trying to minimize plugins. That said, I’ve created a Custom Post Type called “Gigs” to dynamically highlight upcoming shows that my son will be playing. I’ve also created a Custom Taxonomy called “Locations” to dynamically bring in Map, Location URL, and Image for instance. I cannot get any of these custom fields associated with the Locations Taxonomy to display. I’ve also created a second CPT called “Gig Locations” and tried to relate them to the Gigs CPT so that I could display its respective custom fields.

    I can place an ACF Google Maps field directly in the Gigs CPT and it will display through the Elementor Google Maps widget. But the ACF Google Maps fields in either the Taxonomy or 2nd CPT will not display. When attempting to put custom PHP code snippets to “get_meta_terms” etc., nothing happens or the site crashes entirely.

    Thanks in advance for your help!

    qthornton.com

  • Unread

    New Taxonomy Data Not Saved

    Just migrated from CPTUI. Tried to create a new taxonomy for a CPT. The response said it was created, but the only data that gets saved is the name of the taxonomy. Nothing else. Has anybody experienced this and found a solution? Thanks.

  • Unread

    acf taxonomy from gravity forms

    Hi,
    I created a portfolio taxonomy with ACF and I’m trying to pass trough a tag field from Gravity Forms to this taxonomy. But isn’t works.

    This is the code:

    add_filter(“gform_post_data”, “custom_taxonomy”, 10, 2);
    function custom_taxonomy($post_data, $form){
    //—————————————–
    //Replace “post_tag” with your taxonomy name
    $custom_taxonomy = “obituarios_localidades”;
    //—————————————-

    $tags = implode(“,”, $post_data[“tags_input”]);
    $post_data[“tax_input”] = array($custom_taxonomy => $tags);
    $post_data[“tags_input”] = null;
    return $post_data;

    And the portfolio categories are: Obituarios
    Localidades

    Can anyone help me please?

    Thanks.

  • Helping

    how to connect category and tag to the articles made under ACF new post type?

    1- My issues is: the new articles, moved from “wordpress > articles” to a new post type made by ACF, cannot read the new category (taxonomy with hierarchy) and tag (taxonomy without hierarchy) that I created on ACF.

    For example, based on my theme, the category of an article shows above the article’s title. Now, the articles under a new post type shows the old category, but not the the new category (taxonomy with hierarchy).

    based on my theme, the tag of an article shows at the end of the article. Now, the articles under a new post type shows the old tags, but no the new tag (taxonomy without hierarchy).

    A friend of mine recommended me to build a new template for single post for the new post type, but I’m wondering if there is any other ways to do it. Thank you.

    And my next question would be…if this works, how I can make the “apprearance > widgets > mian sidebar” to read all category or tag from different post types…

    Thanks for your answers.

  • Helping

    Searchable Filter for WooCommerce Products Based on Model and Model Year

    Dear people,

    I’ve quietly been struggling with the issue below for quite some time and have now decided to seek help through this forum.

    I have created two taxonomies named “Model” and “Modeljaar” (Model Year). Additionally, I’ve set up an ACF field group linked to WooCommerce products.

    Now, when specifying the compatibility of a WooCommerce product, I can choose both the “Model” and the “Model Year.”

    However, if, for instance, I have 3 models – Volvo, Volkswagen, Audi – and model years such as “2015, 2016, 2017, 2018,” I encounter a problem.

    For example, when I select Volvo and check model years 2015 and 2016, and also select Volkswagen and check model years 2017 and 2018, an issue arises.

    The system fails to distinguish, assuming that Volkswagen is also linked to model years 2015 and 2016, as these model years are not linked to the “Model” taxonomy.

    Ultimately, I need to create a search filter, such as with Search & Filter, and want to be able to search by model and model year. So, if you choose a Volkswagen now, you should also be able to find it when filling in the filter for model year 2015 or 2016.

    I hope I’ve explained my problem clearly.

    Do you have any ideas on how I can solve this?

    Kind regards,

    Miguel

  • Unread

    ACF + Woocommerce Categories Backend

    Hi,
    in recent days I had opened a request on the general forum of the repository regarding this question of mine.

    I created some groups of fields in ACF that are shown in the sidebar, when inserting a product on woocommerce.

    What I can’t do is show the fields in relation to the woocommerce categories.

    Ex.
    – woocat 1 -> group_1
    – woocat 2 -> group_2

    In Position Rules I set the following rules:
    1. Content Type = Product
    2. User Role = Administrator
    3. Item Taxonomy = woocat 1

    But despite this, the group of fields appears in every product page.

    But having read the documentation for developers I created this function which should solve it and could possibly help other users too:

    // Verifica se ACF è installato prima di utilizzare i filtri ACF
    if (function_exists('acf')) {
        add_filter('acf/load_field/name=attributo_montaggio', 'campoextra_acf_montaggio');
        function campoextra_acf_montaggio( $field ) {
            global $current_screen, $post;
            // Verifica se l'utente corrente ha le autorizzazioni necessarie
            if (!current_user_can('edit_posts')) {
                // L'utente corrente non ha le autorizzazioni necessarie, esci
                return $field;
            }
             // Ottieni i termini della categoria corrente
             $terms = get_the_terms($post->ID, 'product_cat');
             
            // Verifica se $terms è un array non vuoto
            if (is_array($terms) && !empty($terms)) {
                //$category_id = $terms[0]->term_id;
                $category_name = $terms[0]->name;
    
                // Array di nomi di categorie da confrontare
                $allowed_categories = array(
                    "Cat Name 1",
                    "Cat Name 2",
                    // Aggiungi altri nomi di categorie secondo necessità
                );
    
                // Verifica se non siamo in modalità amministratore o se il tipo di post non è 'product' o se l'ID della categoria non è nell' array
                if ((!is_admin() && $current_screen->post_type != 'product') || !in_array(strtolower($category_name), array_map('strtolower', $allowed_categories))) {
                    return false;
                }
            }
    
            return $field;
    
        }
    
    }

    I used the load filter and not the prepend.
    Do you think it can be improved?

    Thanks

  • Solving

    ACF Taxonomy

    Hey.

    Im trying to create a loop-item for my custom Taxonomy “product_categories” i’ve assigned 2 fields to it, name => “c_name”, image => “c_image”.

    Now when I im in my loop template, i’ve assigned those fields to the text and image but its not showing me anything. I’ve tried searching internet but haven’t got lucky. so posting here in the end.. im using ACF PRO.

    Do reply to my thread.

    Thank You.

  • Solved

    Taxonomy to Find Category Selected

    Hi,

    I’m attempting to create a query to find any Case Studies (a Custom Post Type) that are selected via the page. This is my first time using the Taxonomy field, and although it works, I get the error in Debug mode “Warning: Invalid argument supplied for foreach() in…”. I’ve followed a few suggestions to fix that, but they don’t show any results.

    My Field Page

    
    <img src="https://postimg.cc/D4GNVRYQ" alt="" />
    

    My Code

    
    <?php
      foreach($case_study_category as $cs) { $cs = get_category($cs); }
      $args = array(
        'post_type' => 'case-study',
        'posts_per_page' => 9,
        'post_status' => 'publish',
        'orderby' => 'publish_date',
        'category__in' => array($case_study_category),
      );
    
      $study_query = new WP_Query( $args);
    
      if ( $study_query->have_posts() ) { 
    ?>
      <div class="post-grid post-grid--scroll-mob">
    <?php
      while ( $study_query->have_posts() ) {
        $study_query->the_post();
    
        $name_title = get_field('name_title');
    ?>
      <a>" class="post-block f-rounded-bottom-lg mob-center-fix">
      
      <?php if(has_post_thumbnail()) {
        the_post_thumbnail('case-study', array('class' => 'post-image post-image--featured', 'alt' => $name_title));
       } else {
      ?>
        <img src="https://placehold.co/1232x924" />
      <?php } ?>
        <span class="post-block__text box-pad-xs d-block">
          <h5 class="font-inter color-black weight-600 text-scale-sm mb-0"><?php echo the_title(); ?></h5>
          <?php if( ($name_title) ) : ?><h6 class="post-sub-title font-quicksand color-blue text-uppercase weight-600 mb-0 text-scale-mini"><?php echo $name_title; ?></h6>
        </span><?php endif; ?>
      </a>
    <?php
      }
    ?>
      </div>
    <?php
        wp_reset_postdata();
      } else {
    ?>
      <p class="color-brown">There are currently no Case Studies to show associated with this service.</p>
    <?php
      }
    ?>
    
  • Solving

    Problem with changing CPT post type key

    Hi guys!
    Can you tell me what is the correct way to change CPT “post type/taxonomy key? Iam testing stuff out, I did the following and I see some strange behavior.
    I created my CPT lets say “dog” with ACF6.23 dint use the advanced settings,
    next I added some dummy posts inside my new cpt.
    I went back to the “dog” CPT settings and changed the “post type key” from “dog” to “dog-something”
    When I did that all the dummy posts inside my admin Dog Cpt dissapeared.
    I tried resaving permalinks – didnt help. When I changed “post type key” back to “dog” they all reappeared on the post list.
    It looks like these post are still somewhere in the database only hidden for some reason?.
    Iam curious to why this is happening or what did I do wrong?
    Thank you for you help!

  • Solving

    Taxonomy field fails loading categories in backend

    I’ve created an ACF taxonomy field that should show my categories inside my custom taxonomy. This taxonomy contains categories and has connected posts. Normally the field should show all the categories, but now it wont. Instead it first loads and after that it gives the error ‘Laden mislukt’ which is dutch for something like ‘Loading Failed’. Does someone know what could be the reason the field won’t load anymore? Beside a font issue we dont have specific errors in the console or php-errors when activating the debug.

    Code for registering the custom post type and taxonomy

    
    
            function cpt_kennisartikel() {
                $labels = array(
                    'name'               => _x( 'Kennisartikelen', 'i2sa'),
                    'singular_name'      => _x( 'Kennisartikel', 'i2sa'),
                    'menu_name'          => _x( 'Kennisartikelen', 'i2sa'),
                    'name_admin_bar'     => _x( 'Kennisartikelen', 'i2sa'),
                    'add_new'            => _x( 'New item', 'i2sa'),
                    'add_new_item'       => __( 'Add new item', 'i2sa'),
                    'new_item'           => __( 'New item', 'i2sa'),
                    'edit_item'          => __( 'Edit item', 'i2sa'),
                    'view_item'          => __( 'View item', 'i2sa'),
                    'all_items'          => __( "All items", 'i2sa'),
                    'search_items'       => __( 'Search item', 'i2sa'),
                    'parent_item_colon'  => __( 'Parent item:', 'i2sa'),
                    'not_found'          => __( 'Search query not found.', 'i2sa'),
                    'not_found_in_trash' => __( 'Search query not found.', 'i2sa')
                );
            
                $args = array(
                    'labels'             => $labels,
                    'description'        => "Beschrijving i2sa",
                    'public'             => true, //openbaar
                    'exclude_from_search'=> false, //uitschakelen voor zoekopdrachten
                    'publicly_queryable' => true, //publiekelijk vindbaar
                    'show_in_nav_menus'  => false, //toon in navigatie
                    'menu_icon'          => 'dashicons-lightbulb',
                    'show_ui'            => true,
                    'show_in_menu'       => true,
                    'show_in_rest'       => true,
                    'query_var'          => true,
                    'rewrite'            => array( 'slug' => 'kb' ), //custom url
                    'capability_type'    => 'post',
                    'has_archive'        => false, //heeft archivepage
                    'hierarchical'       => false, // true maakt het een pagina
                    'menu_position'      => 5, //null = geen
                    'supports'           => array('editor', 'title', 'thumbnail'), //gesupporte functionaliteiten
                );
                register_post_type( 'kennisartikel', $args );
        
                //flush_rewrite_rules();
            }
            add_action( 'init', 'cpt_kennisartikel' );
        
        
            function cstm_taxonomy_kb() {
                $post_types = array('kennisartikel');
            
                $taxonomy_args = array(
                    'label' => 'Artikel Categorie (KB)',
                    'rewrite' => array('slug' => 'tax-kb'),
                    'hierarchical' => true,
                    'public' => true,
                    'show_ui' => true,
                    'show_in_rest'       => true,
                    'show_admin_column' => true,
                    'has_archive' => false,
                );
            
                foreach ($post_types as $post_type) {
                    register_taxonomy('cc_tax_kb', $post_type, $taxonomy_args);
                }
            }
            
            add_action('init', 'cstm_taxonomy_kb');
    
    

    Setup of the field and error attached as screenshot.

  • Unread

    Dropdown list to choose which taxonomy key to use for Elementor Pro dynamic img

    Hi, I need to do dynamic field in Elementor Pro so that Image widget will get featured image from specific taxonomy for Woo product.

    This is the scenario:
    I have Product 1 that is in Taxonomy 1, Taxonomy 2 and Taxonomy 3.
    All taxonomies have its own featured image defined in ACF.
    https://prnt.sc/SX04RemZu3Ap

    So I want to place Image container and choose Dynamic field as source for the image and when I choose key I want to be able to choose specific taxonomy for that place.
    https://prnt.sc/Slz1419_3j_-

    How can I achieve this?
    https://prnt.sc/iVIAd0vyd3Er

    Currently when I choose Featured Image Taxonomy I dont get anything which is reasonable because it gets the url from all taxonomies that this product is member of.

    Thanks!

  • Helping

    Taxonomy RSS Feed

    I am trying to pull an RSS feed into a newsletter using a custom post type and taxonomy. I’ve tried the following URL but it doesn’t seem to work.

    custom post type = news
    taxonomy = newsletter
    the selected taxonomy = featured

    https://www.theave.biz/news/newsletter/featured/feed

    I also tried: https://www.theave.biz/news/category/featured/feed which I don’t think is correct.

    When I use https://www.theave.biz/news/feed it works but it pulls all the posts in.

    Any help would be greatly appreciated.

  • Solving

    Featured image for custom taxonomy

    Hello !

    I’ve created a custom taxonomy and created a custom image field for.
    I would use it as a featured image (for a gridbuiler).
    Any idea how to do it ?

    Thanks !

  • Solving

    Get all repeater fields outside the loop, but grouped?

    I was hoping someone could point me in a direction, as my searches are bringing up things that are not applicable. My posts keep getting marked as sp@m, so excuse my clumsy censoring. I’m not sure what’s tripping it up.

    I have a CPT, “B00ks”. Within that, there is a repeater field for “Editions”. Within that, there is a select dropdown to choose a “Type”, as well as an image field for the “Cover”, and a nested repeater for links to buy them. The structure looks like below:

    B00ks
    ---Editions (Repeater)
    ------Type (Select/Taxonomy)
    ------Cover (Image)
    ------Purchase Links (Repeater)
    -----------Link Name (Text)
    -----------URL (URL)

    I’ve gotten all this to show up on the single-b00ks page in a super spiffy way, and I’m jazzed! I’m now looking to build an “Editions” page which should show all editions of all b00ks, grouped by “Type”. This way, all audiob00ks will appear in a row, and then all paperbacks, and then all hardbacks, so and so forth.

    Since this will be on its own page, it’ll be outside of the CPT loop. I’m not quite sure where to start with both querying the posts, plucking out ONLY the special editions, and then grouping them by tax (if applicable, as some don’t have a “Type”).

    If anyone could point me in a direction, I’d really appreciate it!

  • Solving

    Assigning Custom Fields To Child/Parents?

    Hi,

    Regarding this topic :

    https://support.advancedcustomfields.com/forums/topic/assigning-custom-fields-to-childparents/

    It would be nice to have the same option as “page type” for taxonomies ( taxonomy type )

    has child, or has parent.

  • Helping

    How to display lists of posts by taxonomy slug, indicated in ACF?

    I want to display lists of posts from taxonomy on page where I indicated that taxonomy in ACF field.

    For example, I have pages “Baseball” and “Soccer” that use my custom template. I want to display there lists of posts that have terms “baseball-news” and “soccer-news” from standard tag taxonomy. I can indicate the slug of taxonomy in ACF custom field, so how, having this slug, I can use it to create a list of posts?

  • Solved

    Including a taxonomy in a custom post type’s URL

    Hi. I’ve got a few CPTs and taxonomies set-up using ACF. For one CPT, ‘person’, I want to include a taxonomy, ‘team’, in the url structure. I was hoping ACF would accept taxonomy tags in the URL Slug field in the Advanced post type settings, but it doesn’t seem to be possible. I tried %team%/{slug}, {%team%}/{slug} and {team}/{slug} but none of these worked, unfortunately.

    Is this currently possible in ACF?

  • Helping

    How to sort taxonomy archive by ACF date field?

    The following code works with my custom post type “game”:
    function ptc_customize_wp_query( $query ) {
    if ( $query->is_post_type_archive( 'game' ) ) {
    // Sort portfolio posts by project start date.
    $query->set( 'order', 'DESC' );
    $query->set( 'orderby', 'meta_value_num' );
    // ACF date field value is stored like 20220328 (YYYYMMDD).
    $query->set( 'meta_key', 'release-date' );
    }
    }

    But my custom posts “Game” also have custom taxonomies like “genre”. How can I apply this sorting to these custom taxonomies as well?

  • Solved

    Field group not showing in backend since Woocommerce last update

    I use a field group to add informations to my WooCommerce products from the backend.
    The location rule is set to post taxonomy = a product_cat.
    It was working fine until I update to last WC version (8.2.1).
    Since this update, group field no longer appear on new product when clicking the checkbox of the corresponding product_cat neither is it listed in screen options.
    When editing an existing product, field group appear temporary but if I change any of its options based on taxonomy, it disappears.
    If I change the location rules of the field group to, for example, post type = product, it works normally, so it seems to be related to location rule.
    The issue only affect backend. On frontend everything is working fine.
    I set up a test site with only WooCommerce 8.2.1 and ACF 6.2.1 and the issue is there.

  • Solving

    Restrict editors from adding new terms to custom taxonomy

    I’ve created a custom taxonomy and attached it to a CPT.
    I’ve created terms for the taxonomy.

    I now want to place restrictions on how the editor can edit and assign terms for this particular taxonomy.

    I want to prevent editors from being able to add new terms.

    I also want to present editors with a choice of terms, from which they must select one.

    A radio button UI would be great for this.
    Is there a way to present existing terms for a custom taxonomy as radio buttons?

  • Helping

    Can I use a custom tax for a CPT permalink?

    Hello,

    I’d like a permalink structure like this for my custom post type: /%custom-tax%/news/

    Where %custom-tax% is the term for a custom taxonomy checked in the custom post.

    It’s like the core WordPress permalink where you can have the custom structure like /%category%/%postname%/

    Is it possible with ACF?

Viewing 25 results - 26 through 50 (of 4,539 total)