Support

Account

Home Forums Search Search Results for 'taxonomy'

Search Results for 'taxonomy'

reply

  • @Jonathan Thanks for the detailed response! I do know about WP’s built-in archive functionality, so I should have mentioned that I want my client to be able to edit content on these pages. That’s why I’m taking the page template approach.

    I also should have been clearer in my description above, and said that my custom field is also named “q_and_a_category”. Hence this:

    ‘key’ => ‘q_and_a_category’

    For clarity (and to avoid any potential conflicts) I have changed the custom field name to “q_and_a_category_select”.

    I tried following your advice of changing meta-query to tax-query, and applying what I read here: http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

    I couldn’t get that to display any posts either, and it seems like it would also remove the acf functionality that I’m looking for in the first place…specifically, the ability for my client to manually select which category of post is being displayed on the page.

    Sorry if I’m not understanding you and/or not being clear myself. Looking forward to any additional thoughts, thanks!

  • Hi!

    What you’re trying to do actually already exists in WP. Since you’ve created a custom post type with a custom taxonomy there’s an archive (provided that you have set archive to true when creating the post type). So you should be able to reach each taxonomys posts by having an url something like this:

    http://www.myurl.com/q_and_a_category/design

    Wordpress will use archive.php per default to display these but if you require customization and dont want to affect the regular archives you can create a new template:

    taxonomy-q_and_a_category.php

    If you want specific templates for the terms you can do:

    taxonomy-q_and_a_category-design.php

    etc.

    If you still want to do it in the way you’ve done so far (i would not recommend it) you need to replace the meta-query with a tax-query since the taxonomys terms are not meta values..

    Read more here: http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

  • Thanks for the quick response. It occurs when I go into the Media Library and add then edit a new image or edit an existing one. The edit page comes us correctly initially, with the custom fields, but clicking any of the checkboxes causes it to reload and lose the custom fields. I have the fields divided into three tabs, if that makes any difference. Like TimTee above, I’ve switched to a multi-select field as a stopgap, and that works but it’s not as good.
    There’s no POPUPs involved, as far as I can see, but I may not be understanding your question.
    Thanks, Peter

  • ah.. I see..

    I’ll use yours then.. =]

    Thanks for the advise! ^_^

  • Alright πŸ™‚

    Altho this:

    
    <?php 
    if (get_field('sub_specialty') != '') { ?>
    

    says “do stuff if this field is not an empty string”

    while this (in my code):

    
    <?php if (get_field('sub_specialty')) { //Sub speciality ?>
    

    says “do stuff if this field has any values”. So you should still use that instead πŸ™‚ Its pretty much a shorthand.. say if you want to apply something when there’s no field it could say this:

    
    <?php if (!get_field('sub_specialty')) { //Sub speciality ?>
    
  • Thank you for the suggestion anyway. I’m pretty new in PHP so my code might really seem unsemantic or such. Will work on that ;]

    Thanks! =]

  • Hi!

    Well, it shouldn’t be listed as a “list” as in

      or

        .. I want it listed in one line without touching the css so I coded it that way.. Also, there is a possibility that not all the Doctors will have a “Sub Specialty” that’s why there’s this line of code:

        <?php 
        if (get_field('sub_specialty') != '') { ?>

        I removed the array($terms); too. =]

        Here’s my final code on displaying the term name:

        <?php
            $terms = get_field('sub_specialty');
            foreach ($terms as $term){
                $subspec[] = '<a href="'.$term->slug.'" name="'.$term->slug.'" alt="'.$term->anem.'">'. $term->name .'</a>';
             }
            echo implode(' / ', $subspec);
        ?>
      1. Hi! Okay well I don’t know how your code looked before that was just to show you how to retrieve the name rather than just the id πŸ™‚

        Your code seems a bit excessive and unsemantic. Is there any reason it couldn’t look like this?

        
        
        <?php if (get_field('sub_specialty')) { //Sub speciality ?>
        	<strong>Sub specialty.:</strong>
        	<ul>
        	<?php $terms = get_field('sub_specialty'); ?>
        	<?php foreach ($terms as $term){ ?>
        			<li><a href="<?php echo $term->slug; ?>" name="<?php $term->slug; ?>" alt="<?php $term->name; ?>"><?php echo $term->name; ?></a></li>
        	<?php } ?>
        	</ul>
        <?php } ?>
        

        There’s no unnecessary functions running, the else-statement was removed, the if statement is changed to be simpler, name was corrected and the html is semantically correct since it’s now an unordered list instead of links with an inline break. πŸ™‚

        Happy coding

      2. Hi Jonathan!

        I switched the return value to Term Object as your reco but the code did not work. Anyways, I fixed it already and here’s my working code:

        <?php 
        						/* sub specialty */
        						if (get_field('sub_specialty') != '') { ?>
        						<strong>Sub specialty.:</strong>
        						<?php
        $terms = get_field('sub_specialty');
        array($terms);
        foreach ($terms as $term){
        $subspec[] = '<a href="'.$term->slug.'" name="'.$term->slug.'" alt="'.$term->anem.'">'. $term->name .'</a>';
        }
        echo implode(' / ', $subspec);
        ; ?>
        						<br />
        						<?php } else { ?>
        						
        						<?php } ?>

        I added some codes too according to how I want it to be displayed.

        Thanks for replying btw. =]

        God bless!! ;]

      3. ah..

        On the field in admin you can select wether you want it to return the term ID or the term object.. Switch it over to term object then do this where you want the name:

        
        <?php echo $term->name; ?>
        

        This is based on that in your foreach loop you call the single term $term. So just switch that out if you use something else πŸ™‚

      4. Hi @pfitz

        Just to confirm, the issue is when you have the check-box field appearing on the media POPUP window?

        Thanks
        E

      5. Hi! The custom post type is “dims”.. the Departments is a custom taxonomy… =]

        Here is how I want it to be:
        I have a custom post type “Doctors”, each “Doctor” are assigned in different “Department” and has “Sub-Specialty/Specialties”..

        The Sub-Specialty should have the same list as of the Department, so I used the Relationship > Taxonomy of ACF to call the list of “Departments”. It’s working on the back-end, but on the front-end, what being displayed is the Item ID of the “Department” not the Item Name/Value.

        The taxonomy “Departments” is in checbox format.. =]

        Thanks!

      6. Nevermind, I’ve found the solution. It was an error caused by the Events Plugin I’m using ! I finally got it to work πŸ˜‰

        Thanks a lot !

      7. Hi!

        Do you mean that departments are a custom post type?

        I dont understand how the setup is.. πŸ™‚

      8. Sorry, should have added that I’m using ACF v4.2.2.

      9. I’m afraid the problem is still there for me. I’m using a Taxonomy field and checkboxes, and the Field Group is for ‘Attachment is equal to all’. Any time user clicks on any checkbox in the field, the page reloads and the custom fields disappear – just as reported initially above. Love ACF, this issue not so much! Peter

      10. Hi,
        Yes here is the code :

        <?php $values = get_field('animateurs_event');
        if($values)
        {
        echo '<ul>';
        foreach($values as $value){
        echo '<li>' . $value . '</li>';}
        echo '</ul>';
        }
        var_dump($values);	 
        ?>
      11. Hi @abiwab

        Just to clarify, the var_dump was of the get_field value?

        The returned value should be an array, not a string…

      12. Do not use a custom tinymce.

        I have the WP in Spanish.

      13. I’m having this same problem on my site.

      14. Confirming the same bug. It appears that checking the taxonomy on the media edit screen adds a acf-hidden class to the meta box. The screenshots linked below show the meta box class before and after checking the taxonomy item. The other screenshots show the ACF field group settings.

        WordPress Version 3.6
        ACF Version 4.2.2
        No ACF Add-Ons.
        No other plugins.
        Chrome (OSX) Version 29.0.1547.57

        Before taxonomy checked:
        http://cl.ly/image/3v0X2k2D0m1e

        After taxonomy checked:
        http://cl.ly/image/3z2b3f1r2c2Y

        Field group settings:
        http://cl.ly/image/1b450G2Y2l30
        http://cl.ly/image/2J0K0Y1I352o

      15. Hi @dcarchenilla

        Thanks for the screenshot. Yes, the issue is JS based and coming from the tinymce script. Unfortunately, the issue could be anything…

        Does your WP site use a custom tinymce? Perhaps because of the language translation?

      16. Thanks elliot, lets not change the serialized array so that its not queryable πŸ˜‰

      17. Hello,
        Hope that helps.
        In a custom post works well, but in a taxonomy editor is not displayed.
        Thanks again

      18. Hi @dcarchenilla

        2 things:
        1. Can you attach a screenshot of the issue?
        2. Have you checked your console log for JS errors?

      Viewing 25 results - 3,051 through 3,075 (of 3,191 total)