show ACF extra information with tagdiv

Posted in: Newspaper
Post count: 18

I need your help please!

Good I am using ACF to show some extra data.
In the following modules I have been able to show it without any problem:
\td-composer\legacy\Newspaper\includes\modules\td_module_flex_1.php
\td-composer\legacy\Newspaper\includes\modules\td_module_flex_5.php

https://imgur.com/tm49MEC

I get it like this:
echo get_field(‘interviewed_name’,$this->post->ID);
echo get_field(‘interviewed_occupation’,$this->post->ID);

Now I want to show them under the main title of an entry. I do not get it, I can not get the data of the post! It seems that since it is a shortcode and not a module it does not allow me to obtain it.

https://imgur.com/RnclO9i

How could I show that data?

Post count: 35449

Hi,

So in order to display the ACF inside the post you need to set the code in the templates you are using (this option is for the standard post templates), for example if you are using post style 1 then you need to set the code in wp-content/plugins/td-standard-pack/Newspaper/parts/single/loop-single-1.php -> https://i.imgur.com/keAR6KV.png
If you are using a single post template from tagDiv Cloud Library, then you need to set the code in one of these shortcode https://i.imgur.com/gLoYC17.png -> wp-content/plugins/td-cloud-library/shortcodes/single

Hope this will help you!
Thank you!

Post count: 18

You are A MACHINE!!! it works!!

Post count: 45

Hi, I am running into a problem:

If I add echo '<b>Genere: </b>'.get_field('genre').' '; inside an existing template (ie plugins\td-standard-pack\Newspaper\parts\single\loop-single-8.php) it works just fine, I see

Genre: Rock

What I am trying to do, though, is to inject the field in a custom template. Following your suggestion, I decided to edit td-cloud-library\shortcodes\single\tdb_single_subtitle.php


//if ( empty($post_subtitle_data['post_subtitle'])) {
// return $buffy;
//}

$buffy .= '<div class="' . $this->get_block_classes($additional_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-block-inner td-fix-index">';

$buffy .= '<b>Genere: </b>'.get_field('genre').' ';
//$buffy .= '<' . $title_tag . '>' . $post_subtitle_data['post_subtitle'] . '</' . $title_tag . '>';
$buffy .= '</div>';

$buffy .= '</div>';

return $buffy;

the result is that the field data doesn’t get pulled.

I see “Genre: ” instead of “Genre: Rock”.

Any idea what could be causing this?

Post count: 45

Just want to write an update on this: something super weird!

The edit I did actually worked, but only if I put the Subtitle element before the raw containing the post content, or after it. Just not in the same row.

No clue why, but this fixed it for me.

Post count: 27744

Hello,

I’m glad that you manage to find a solution.
The implementation of ACF for cloud library is much harder to achieve than for Standard pack and requires more knowledge (developer skills).

Thank you!

Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.