Display acf field in cloud template

Posted in: Newspaper
Post count: 61

Hi, I use acf plugin, to display additional field info for user.

$author_info = get_field('info', 'user_'. $td_author->ID );
if (!empty($author_info)) {
$buffy .= '<div class="td-author-info">';
$buffy .= $author_info;
$buffy .= '</div>';
}

How to add this field, so it can be displayed in Cloud template I set for all authors.

Thanks

Post count: 23312

Hi,

Unfortunately, this plugin has not been tested with our theme and therefore, we can not provide custom implementation, sorry! If you need to add something like this, you should do it yourself through the code and if you are not aware of the steps which are needed to take in this case, please consider hiring a freelancer/developer to help you! usually, we recommend the developers from studio.envato.com.

Thanks for the message!

Post count: 61

Hi, I’ve been able to add this field, following the documentation Here
I was able to add my custom block to the TagDiv Composer, and it displays the field content on the authors’ page correctly. But I have this error:

error

Here’s the code I pasted inside td_block_creative.php



<?php

class td_block_creative extends td_block {

    function render( $atts, $content = null ) {
        parent::render( $atts ); // sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query)

        global $tdb_state_author;
       // $author_description_data = $tdb_state_author->description->__invoke( $atts );
        $author_loop_data = $tdb_state_author->loop->__invoke( $atts );

        $buffy = ''; //output buffer

        // when no data - return empty on frontend
        if ( empty($author_loop_data['author_id'])) {
            return $buffy;
        }

        $buffy .= '<div class="' . $this->get_block_classes() . '" ' . $this->get_block_html_atts() . '>';

            //get the block css
            $buffy .= $this->get_block_css();

            //get the js for this block
            $buffy .= $this->get_block_js();

            $buffy .= '<div class="tdb-author-descr">' . get_field('additionalinfo', 'user_'. $author_loop_data['author_id'] ) . '</div>';

            $buffy .= '</div>';

        $buffy .= '</div>';

        return $buffy;
    }

}

Files: td-creative-plugin.php and style.css I left without changes. Please help me to fix this error.
Thanks

  • This reply was modified 7 years by pbc.
Post count: 23312

Hi,

Unfortunately, please notice that we cannot provide support for your custom implementation, sorry! That section is addressed only for advanced users and if you encounter some errors, it’s possible that you make something wrong through the code, sorry! If you are not aware of the steps which are needed to take in this case, please consider hiring a freelancer/developer to help you!

Thanks.

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.