Giter VIP home page Giter VIP logo

Comments (13)

kpoelhekke avatar kpoelhekke commented on August 24, 2024

Same here :(

from acf-tax.

FutureMedia avatar FutureMedia commented on August 24, 2024

Sorry guys but, unfortunately, I cannot follow the plugin's author updates.

from acf-tax.

kpoelhekke avatar kpoelhekke commented on August 24, 2024

I'm currently figuring out a fix. If i found i'll post it here.. (hopefully today)

from acf-tax.

FutureMedia avatar FutureMedia commented on August 24, 2024

Ok, thanks.

from acf-tax.

kpoelhekke avatar kpoelhekke commented on August 24, 2024

Overwrite this function:

This works :)

function get_value_for_api($post_id, $field)
{

    // format value

    $value = parent::get_value($post_id, $field);

    $term_links = array();
    foreach( $value as $term_id ) {
        $term_id = intval( $term_id );
        $term = get_term( $term_id, $field['taxonomy']);
        $link = get_term_link( $term, $field['taxonomy'] );
        if( !is_wp_error( $link ) )
            $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>';
    }


    if( empty( $term_links ) )
        return false;

    // return value
    return join( '', $term_links ); //$value; 

}

from acf-tax.

kpoelhekke avatar kpoelhekke commented on August 24, 2024

Removing the last join and replacing it with 'return $term_links;' will make te function more versatile

from acf-tax.

 avatar commented on August 24, 2024

Hello, and thanks a lot for your fast reply,

I still have the problem, my function is now :

function get_value_for_api($post_id, $field)
{

    // format value

    $value = parent::get_value($post_id, $field);

    $term_links = array();
    foreach( $value as $term_id ) {
        $term_id = intval( $term_id );
        $term = get_term( $term_id, $field['taxonomy']);
        $link = get_term_link( $term, $field['taxonomy'] );
        if( !is_wp_error( $link ) )
            $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>';
    }


    if( empty( $term_links ) )
        return false;

    // return value     
    return $term_links;

}

from acf-tax.

 avatar commented on August 24, 2024

Sorry for the close !

from acf-tax.

kpoelhekke avatar kpoelhekke commented on August 24, 2024

What is the problem exactly? I'm using the above code and it's working properly...

from acf-tax.

 avatar commented on August 24, 2024

I still have this warning :

Warning: Invalid argument supplied for foreach() in themes/talm/fields/acf-tax.php on line 346

from acf-tax.

kpoelhekke avatar kpoelhekke commented on August 24, 2024

Hmm.. i'll look into it tomorrow. I also still have some problems while using the flexible field type. I'll keep you updated.

from acf-tax.

 avatar commented on August 24, 2024

oups I really apologize, my file was duplicated and I was looking the bad one. Problem solved ! Thanks again.

from acf-tax.

kpoelhekke avatar kpoelhekke commented on August 24, 2024

like

from acf-tax.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.