This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Custom Taxonomy / Image in search

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Custom Taxonomy / Image in search

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8573
    mammothreachmammothreach
    Participant

    I am trying to display a custom image using either a featured image or an ACF image field when displaying custom taxonomies. Is this possible? I was directed in the comment area to submit a ticket.

    Thanks!

    #8582
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    I have found a previous ticket where a similar issue was solved, and he also used the Featured Categories for images plugin.

    Try to put this code into the functions.php file in your active theme directory:

    [php]
    add_filter(‘asp_results’, ‘asp_get_fifc_term_image’);
    function asp_get_fifc_term_image($results) {

    foreach($results as $k => $result) {
    if ($result->content_type != ‘term’) continue;
    $thumb_id = get_option( ‘_wpfifc_taxonomy_term_’.$result->id.’_thumbnail_id_’ );
    if ($thumb_id !== false) {
    $image = wp_get_attachment_url( $thumb_id );
    if (!empty($image))
    $results[$k]->image = $image;
    }
    }

    return $results;
    }
    [/php]

    I have tried to log-in via FTP to test this, but it could not connect to the provided server. Let’s hope this works.

    #8588
    mammothreachmammothreach
    Participant

    Worked like a charm. THANK YOU.

    #8589
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Custom Taxonomy / Image in search’ is closed to new replies.