No Text-Output

Posted in: Newspaper
Post count: 55

I use with me the plugin ACF. So I let once in the source text output the metadata for the address and once as Kontakdetails in the article.

Recently, the issue of contact details in the article no longer works.

The function looks like this:

// Company Details
function company details () {

if (is_single ()) {
        $ company = get_field (‘company’);
        $ company = explode (‘_’, $ company);

if (isset ($ company [0]) && $ company [0]! = ‘none’) {

echo ‘<div class = “contact”> Contact Information </ strong>: ‘;
echo ”. $ Company [0];
if (isset ($ company [1]) && $ company [1]! = ‘|’) {
echo ”. $ Company [1];
}
if (isset ($ company [2]) && $ company [2]! = ‘|’)
{
echo ”. $ Company [2];
}
if (isset ($ company [3]) && $ company [3]! = ‘|’)
{
echo ”. $ Company [3];
}
echo ”. $ Company [4]. ”. $ Company [5];
if (isset ($ company [6]) && $ company [6]! = ‘|’)
{
echo ”. $ Company [6];
}
if (isset ($ company [7]) && $ company [7]! = ‘|’)
{
echo ”. ‘‘. $ company [7]. ‘ ‘;
}
if (isset ($ company [8]) && $ company [8]! = ‘|’)
{
echo $ company [8]. ‘ </ p> </ div>’;
}
}
}
}

It is output in the loop-single.php with the command:

<div class = “contact”>
<? Php
if (function_exists (‘company details’)) {company details (); }?>
</ Div>

The contact details should actually appear directly below the article. Here (https://salzsau-panorama.de/2018/11/07/zimt-zinnober/) for example after ‘Für Fragen stehen wir Ihnen gerne zur Verfügung.’

Unfortunately that does not work.

Any idea why that is?

Post count: 20688

Hi,

Can’t say I experimented much with the ACF plugin. Maybe double check their documentation and review the code you have currently
https://www.advancedcustomfields.com/resources/
Check if it works and the fields get displayed in a more basic code like just displaying the field, then add the conditions and keep testing.

Also a topic with some examples in displaying custom fields in the post templates
https://forum.tagdiv.com/topic/custom-fields-howto-any-help/

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