Support

Account

Home Forums Search Search Results for 'taxonomy'

Search Results for 'taxonomy'

reply

  • Hi @customaniac

    This would be best left as a tag taxonomy.

    This will also allow you to perform powerful taxonomy queries.

    Are you able to use a custom taxonomy?

  • Hi @funack

    I am yet to find a solution for this.

    As discussed in the old support thread:

    Term meta is stored in the wp_options table (as there is no ‘default’ meta table for terms). Each option_name is prefixed with the taxonomy name + term_id

    Like this:

    category_2_image => 123

    I don’t think it is possible to perform a meta query due to the way data is stored.

    Perhaps you could look at another term_meta solution?

  • +1! This is exactly the kind of feature I requested on the old forum. Such a front-end filter would be immensely useful.

  • Well I dont know if I understood well, but for me it worked well in 4 languages site.

    I’ve created a set of Custom Fields in my main language, but than had to translate this set for the other 3 languages.

    Initially I forgot to translate a few fields on the Spanish set, so when I was doing the post translation to Spanish there where some things missing.

    But I have other problem. Two of my Advanced Custom Fields are checkboxes populated by taxonomies. The thing is that there is taxonomy of ‘materials’, and some of the material have the same name in all the 4 languages. Things like ‘PVC’. In cases like this WPML adds ‘@en’, ‘@fr’, ‘@es’ in front of the taxonomy term. If I use some WordPress function to list the taxonomy terms the ‘@**” are filtered out… but everything that gets displayed by the ACF functions show those ‘@**’… Can someone help me on this?

  • Nevermind, the following worked:

    <?php 
     
    // vars
    $queried_object = get_queried_object(); 
    $taxonomy = $queried_object->taxonomy;
    $term_id = $queried_object->term_id;  
     
    // load thumbnail for this taxonomy term
    $thumbnail = get_field('background_image', $taxonomy . '_' . $term_id);
     echo $thumbnail;
    ?>
  • Hi @treebeard

    Sorry mate. Your code contains too make syntax and PHP errors for me to help on this one.

    I would advise you to read over the documentation for the image field to find out how it works.

    1. Use get_field
    2. Address the if statement inside your img src
    3. Correct the field names
    4. Correct the field return types
    5. Your code has no reference to anything taxonomy related

  • Thanks.

    What I’m having trouble with is the code to use. ACF code.

    Here’s what I tried that’s not working:

    <?php if ( get_post_meta($post->ID, 'my_image', true) ) : ?>
    <a href="<?php if ( get_post_meta($post->ID, 'my_image_link', true) ) : ?>"><img src="<?php the_field('my_image'); ?>" /></a>
    <?php endif; ?>

    This is what I’m having trouble with. When I add the ACF code to load the Taxonomy (which should be converted to a link, since the ACF Link field isn’t working for some reason) I’m not getting a real link, I’m getting a link to a number that goes nowhere.

  • Hi @treebeard

    No worries.

    You need to break your task up into easy to tackle stages.

    1. Create a field group for the taxonomy, and add an image field.

    2. Edit your taxonomies and add the image data for each

    3. Create a custom page template an give it a name such as ‘Taxonomy Thumbnails’

    4. Create a page in the CMS and use this page template. View the page to see a blank white screen.

    5. Search on WP how to get all the taxonomy terms and loop through them. There is lots of documentation for this on the web.

    6. Finally, within the taxonomy loop, use the term_id to load in the ACF image data and render the image!

    7. Pop open a beer!

  • Sorry, let me paste what I wrote up there:

    “there is no documentation for this particular thing here, no example code”

    What I mean is there’s no documentation for what I’m trying to accomplish. I did review the documentation that is available and tried using that to create a link to the category, as I mentioned in my original post:

    “I’ve tried messing with the Taxonomy Field (along with the Image field), but couldn’t get that to work as a link (image would link to a number, but it didn’t go anywhere).”

  • Found a workaround using jquery, it works with an ACF taxonomy single select drop down. It moves the add term form to just under the drop down and when a term is clicked from the drop down it populates the add term field and simulates a click on the add button.

    The acf select needs to be set to not update terms.

    
    var $j = jQuery.noConflict();
    $j(document).ready(function() {
    
    $j("#my_taxonomy").insertAfter("#acf-my_taxonomy_field");
    	   $j("#tagsdiv-my_taxonomy").hide();
    
    	   $j("#acf-my_taxonomy_field select").change(function(){
    	   	var term = $j('#acf-my_taxonomy_field select').find(":selected").text();
    	   	//alert(term);
    
    	   	$j('#new-tag-my_taxonomy').val(term);
    	   	$j('#my_taxonomy .tagadd').trigger('click');
       	});
    
    });
    
  • sorry for the bother Elliot, it seemed like buggy behaviour but I can see why it’s set up like that now. I was trying to use this method as a workaround for the lack of a way to add a term, previous issue here adding a term with ACF I got this working with javascript, code on the linked issue.

    cheers,

    Tom

  • Ok Thank you. Which Code I must use to display only the posts of the selected category from the taxonomy newskategoeie?

    Thank you for your help.

  • Hi @treebeard

    The easiest way to do this is to create a field group which contains the image field, and use the location rules to attach this field group to the taxonomy you want.

    Now when you edit the taxonomy term you will be able to add an image. Thus associating an image with each term (cagtegory).

    A page that shows all the taxonomies? That sounds like a taxonomy archive page and you can read about these on google / wp.org

  • Hi @blackpenpress

    The taxonomy field (when saving and loading to the post) will remove all connections on save, and then save only the selected connections.

    You can’t use this in combination with the WP taxonomy box.

  • Hi @elliot

    Yes, I can see that you have selected a post object (which is titles the same as the category it is in.)

    I am now more confused as you have multiple relationship fields…

    Can you please start this question again with clarity. And please state what is NOT working, and what IS working.

    This is a guess, but on each page, you have ‘right’ and ‘left’ modeuls. In your right 1 module, you want to load in the category which is assigned to the post object of the same name?

    Are you using a promo box as a dummy holder for the taxonomy? Or are you loading any extra data from the promo box? Why are your promoboxes called the same as your category?

  • Hi,

    ok I wan’t to descripe the problem.

    My Mainsetings for this field are the following. I Think you don’t need more setting information ore did you need some spezial infos?

    Feld-Typ: Artikel-Bezeihung
    Artikel-Beziehung: News Kategorien
    Feld-Typ: Auswahlmenü
    Nichts (NULL) erlauben? Nein
    Lade & Speichere Einträge im Artikel: Not marked
    Rückgabewert: Datei

    When I’m looking in the Frontend I won’t get displayed the Newsarticles of the category “News Kategorien”. There will be linked the hello world post and a attchment. But the hello world post is not in the “News Kategorien”. And I have delete them, it is only in the trash folder.

    When I put the debug code inside I get this response.

    
    stdClass Object
    (
        [term_id] => 7
        [name] => Category Name
        [slug] => category-name
        [term_group] => 0
        [term_taxonomy_id] => 8
        [taxonomy] => newskategoeie
        [description] => 
        [parent] => 0
        [count] => 1
    )
    

    There was at [name] an [slug] the right Name inside. But I won’t displays them here.

  • Thanks E, I really appreciate your help with this.

    • You have a CPT called ‘Promo Boxes’ – Yes
    • ‘Promo Boxes’ suports the ‘category’ taxonomy – Yes
    • Promo Boxes has some custom fields. What are they? Are they relevant to this issue? – I’m not sure if they’re relevant, but just in case: Content (Wysiwyg Editor), Image (image), Link (text), Alternative title (text), Latest News or Reports? (Radio button)
    • You are tyring to load the category ID. Where from. – I’m not exactly sure how to answer this question, but the user may choose a category for a Promo Box, I’d like this category to be loaded, if Latest News or Reports? == Yes
    • What URL are you looking at? – http://burma.23.co.uk/campaigns/crisis-in-arkan-state/ – specifically the first box in the right column (News). Happy to give you admin access if that helps
    • What template file is running – I’m using the Roots theme and it’s base.php template, alongside four other custom templates: section.php (in the root folder, necessary for Roots, primarily used to import the three subsequent templates); left-section.php (the left sidebar); content-section.php (the centre column), right-section.php (the right sidebar).

    Does that give you what you need?

  • Hi @jordan314

    I have not yet tested ACF with the user taxonomy plugins so I can’t guarantee this would work.

    Are you able to use the WP interface for this instead of ACF for now?

  • Hi @Debatewise

    I think we need to go back to the start of this project and learn to crawl before you try to run.

    Can you please re-explain the issue without refering to any code or work you had previously done. Lets start fresh so I can understand the issue.

    * You have a CPT called ‘Promo Boxes’
    * ‘Promo Boxes’ suports the ‘category’ taxonomy
    * Promo Boxes has some custom fields. What are they? Are they relevant to this issue?
    * You are tyring to load the category ID. Where from. What URL are you looking at? What template file is running?

    Thanks
    E

  • Hi @trasyhoob

    Just to clarify, are you saying:

    You have a front end form for editing a post. When you select a taxonomy value for this post, you would like ACF to load in any new field groups which now match (like in the wp-admin)?

  • Hi Elliot,

    1. You are setting the variable $post_objects twice. Why?
    Most probably because I don’t know what I’m doing :). I’ve removed the extraneous one on my code now.

    2. I can’t see in your code where you are loading the category for.
    I think this is my problem, I’m not sure how to load the category. What I’ve done is:

    1. Created a custom field type (Promo Boxes) – which includes the categories built-in taxonomy
    2. Created custom fields and tied them to the Promo Boxes CPT
    3. Created a post in Promo Boxes and assigned it to a category
    4. Tried to grab the category ID from this particular post

    Does that make sense?

    There is no custom field containing the category name, should there be?

  • Hello, I have a number of taxonomies, frond end ACF form and html-select of this taxonomies. I want to load group of fields which match selected taxonomy dynamically… (via ajax)… how i can do this…?

  • Thanks Elliot,

    I’ll see if I can put together a new field type, looks like it shouldn’t be too difficult to add a simplified version of wp’s term adding form to the taxonomy picker.

    Thanks for all your work on ACF, it’s an incredibly useful plugin!

    Tom

  • Hi @blackpenpress

    Yes, currently you will need to use WP to create a term. ACF taxonomy field is only to select them.

    Hopefully in the near future, we will see this feature added.

    Thanks
    Elliot

Viewing 25 results - 3,126 through 3,150 (of 3,190 total)