Support » Plugin: AnyWhere Elementor » ACF in taxonomy values

  • Resolved pipoulito

    (@pipoulito)


    Hi,

    I added AFC for each values of my taxonomy (images, color)
    I tried to display them with AE taxonomy custom field but it did not work..
    thanks for help

Viewing 9 replies - 16 through 24 (of 24 total)
  • maybe in post-custom-taxonomy.php ?

    in tax-custom-field.php

    Plugin Contributor Hemant Tejwani

    (@tejwanihemant)

    Yes you can create a shortcode for this.
    Paste this below code in your child theme’s function.php.
    Then ‘Shortcode Widget’ of Elementor and paster [AEP_PostCatFields] this shortcode.
    May be not worked in editor but check on frontend.

    function getPostCatFields() {
    global $post;
    $categories = get_the_terms( $post->ID, ‘category’ );
    if ( isset( $categories ) ) {
    foreach ( $categories as $cat ) {
    $image_id = get_term_meta( $cat->term_id, ‘image’, true );
    echo wp_get_attachment_image($image_id, $size = ‘full’, $icon = false, $attr = ”);
    }
    }
    }
    add_shortcode(‘AEP_PostCatFields’, ‘getPostCatFields’);

    wow thanks a lot !!

    i pasted it in my functions.php
    and added [AEP_PostCatFields] in a shortcode widget in my page , am i right ?
    because nothing is displayed.

    my acf field is named ‘picto’ shouldn’t put it somewhere ?

    i have this on frontend
    [AEP_PostCatFields]

    ah there was a problem with quote character ” now i don’t have [AEP_PostCatFields] but nothing…it’s blank

    i replaced ‘category’ by ‘my_category’ and ‘image’ and it works !!

    function getPostCatFields() {
    global $post;
    $categories = get_the_terms( $post->ID, ‘my_category’ );
    if ( isset( $categories ) ) {
    foreach ( $categories as $cat ) {
    $image_id = get_term_meta( $cat->term_id, ‘picto’, true );
    echo wp_get_attachment_image($image_id, $size = ‘full’, $icon = false, $attr = ”);
    }
    }
    }
    add_shortcode(‘AEP_PostCatFields’, ‘getPostCatFields’);

    THANKS THANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKSTHANKS

    THANKS !

    Plugin Contributor Hemant Tejwani

    (@tejwanihemant)

    resoolved

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘ACF in taxonomy values’ is closed to new replies.