• Resolved bchpdigital

    (@bchpdigital)


    Hi there. Firstly, thank you for this plugin, it is working wonders. Combining ACF and ACF Views has unlocked so much pontential and I’ve very excited to keep working with this.

    I have reached a stump, and I feel like it’s a simple solution, I just can’t figure out what exact words I need to put in between the {{__}} on some custom templates.

    I am working on this page: https://burtonconstableholidaypark.co.uk/live-sports/its-derby-day/

    I want to display a small logo with the Team Names; “Hull FC, Hull KR” in the blue section of this page.
    This is an ACF Views item, which is assigned the “Teams” taxonomy from a “sports” field group.

    This is working great and the linked term title loads into my template nicely out of the box with ACF Views. But I want icons too alongside the title.

    Previously in another ACF View item, I created some custom esleif statements to produce an img and src based on the term value. However, that means adding the if statements and image URLs to the Custom Template every time I add a new term.

    I want to be able to add new terms on the go without updating the template. So, I have created a custom field group with one custom image field in it for “team_logo” and assigned that to the “teams” taxonomy. Each term in the “teams” taxonomy now has an image.

    However, back to my ACF Views item template, I cannot figure out how to customise the template code to get and display the “team_logo” field from the taxonomy term.

    My understanding is, that the ACF Views template gets the term value from the taxonomy, and displays the term title.
    I messed with the template code and noticed I could change “title” to “value”, which returns the URL. However, if I change this to anything else, such as “team_logo”, I get an error message on the front end suggesting that the options are limited to title, value, etc.

    I’m not sure what setup is required here.
    As the custom image field is assigned to a term, within a taxonomy.
    When an ACF View item is assigned a field group, with that taxonomy as a field, can it access the custom image field?
    If so, how? Is there an alternative setup that would make it accessible?

    Does that make sense? Thanks for any advice.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WPLake

    (@wplakeorg)

    Hi @bchpdigital

    Thank you for your nice words, and for supporting ACF Views!

    What you’ve described is a way to display Taxonomy term names with its ACF field (image).
    Unfortunately that isn’t yet possible.
    You can however use $term$ with term-id=”x” in your View shortcode to display the specific term acf image.

    Below is an example

    [acf_views name="Teams Taxonomy list" view-id="652f946aaca87" object-id="$term$" term-id="116"]

    We hope to have the $taxonomy$ ACF fields feature soon.

    Thread Starter bchpdigital

    (@bchpdigital)

    Hi. Thanks for the swift response.
    I think I see what you are saying. If I’m understanding this correctly, you’re saying that with the Shortcode, I can choose a specific single-term’s image and display that next to the term titles. So I can define a specific term ID to get the image from?

    If so, that won’t work for what I’m after. I’m using these shortcodes in templates to grab the fields dynamically and new content is continually added. So static content in the shortcode isn’t an option. Each of my custom post types has its own field group and template. Plus, in this instance, I have multi-select for the terms.

    I have had a go with your example and I think I have adjusted the names and ID’s appropriately. I couldn’t get it to display anything with the changes to the shortcode. It didn’t return an error, but it also wouldn’t display anything. It is great to know that there is more that can be done with the shortcode and I will look into the documentation further regarding this.

    I’d be open to trying an alternative way outside of taxonomy, if there’s another way to achieve this. I like to have the archive by using taxonomy, but I’d still be interested to learn of other methods that may be able to use a view shortcode to grab custom fields from within another custom post or item.

    Otherwise, I eagerly await the availability of &taxonomy& and other functions to come in the future!

    Thread Starter bchpdigital

    (@bchpdigital)

    I’ve updated to the pro feature to solve a different issue I was having. I have been playing around with the ACF View Cards allowing me to create query loops that Ajax pagination. Really nice usability for the site.

    Anyway, I have just noticed an extra option on my ACF Views called… “ACF Views”. Clicking read more states this is a pro feature that lets you refer to fields from related selected views. I think I can use this to make my idea here work! I can create a new ACF View for the “Sports Team Logo”, then relate that to my other taxonomy view. I will have a play, but it sounds like it should work!

    Plugin Author WPLake

    (@wplakeorg)

    Hi @bchpdigital

    I’ve read your initial request again, and I think I misunderstood.
    I thought you’d want to show a Image field assigned to a taxonomy group.
    But you actually want to show Posts by Category? Is that correct?

    In this case, you can Create a View, assign the fields you’d want to display, then head over to Add a New Card, assign the View, and use the Taxonomy filter tab to filter by “Categories” or your Custom Taxonomy with Comparison set to “Equal to” and then for Term select “$current$ (archive and category pages)”.
    The save, and copy the Card shortcode into your Post Category template.

    Hi there, I have been created two custom fields with acf and I want to display them in every post in the front end in two diferrent places (after post title the first and after excerpt the second) with labels explaining each value. Also the same when posts displaying in blog archive posts. I added the code below (only for the first custom field) in the file content.php under the post title section. I am not familiar with coding and I need your help please!

                $custom_field_value = get_field( 'syggrafeas' );
                if ( $custom_field_value ) {
                    echo '<div class="custom-field-label">Συγγραφ?α?:</div>';
                    echo '<div class="custom-field-value">' . esc_html( $custom_field_value ) . '</div>';
                }
                ?>



    Please give me a solution

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to display a Custom Field for a Custom Taxonomy?’ is closed to new replies.