简体   繁体   English

WordPress未使用ACF显示类别

[英]WordPress not showing a category with ACF

The WordPress website I am debugging is used as an intern tool to publish reports. 我正在调试的WordPress网站被用作发布报告的实习工具。

When a user want to create a new report, they select the function, select the categories of informations they want to add, then at the bottom text boxes will be created with the right titles and people can then write the informations they have. 当用户要创建新报告时,他们选择功能,选择要添加的信息类别,然后在底部创建带有正确标题的文本框,然后人们可以编写他们拥有的信息。 When they click "publish" it posts a report with all the caterogies, with the title of each one followed by the info. 当他们单击“发布”时,它将发布包含所有类别的报告,每个类别的标题后跟信息。

My problem: One of the categories, named Urgences Environnementales , is showing correctly in the list of categories when creating a new report. 我的问题:创建新报表时,名为Urgences Environnementales的类别之一正确显示在类别列表中。 If I click on it, it creates the text box at the bottom, but when I publish, it's not in the report. 如果单击它,它将在底部创建文本框,但是在发布时,它不在报告中。

To build the website, they used child themes. 为了建立网站,他们使用了儿童主题。 One is for the report. 一个用于报告。 In the functions.php file, I can see this code: functions.php文件中,我可以看到以下代码:

foreach($get_posts as $idnumber){
...
$tableau_cog .= htmlspecialchars("<br/>".get_field('tableau_cog', $idnumber->ID));

And

update_field('tableau_cog',preg_replace('/(<br[\s]?[\/]?>[\s]*){2,}/', '<br/><br/>', htmlspecialchars_decode($tableau_cog)), $identificationRapport);

All the other categories have the same code but with their respective names. 所有其他类别均具有相同的代码,但具有各自的名称。 This is in the child's theme: 这是孩子的主题:

if(in_array( 'Tableau COG', $tâches)){
      echo "<h2 style=\"text-align: left;\"><strong>Tableau COG</strong></h2>";
      simplebox(in_array( 'Tableau COG', $tâches), get_field('tableau_cog'));
}

Again, the other categories have the same code with their names. 同样,其他类别的名称也使用相同的代码。

The problem is that it seems they simply changed the name of an old category, as Tableau Cog is not a category. 问题在于,似乎它们只是更改了旧类别的名称,因为Tableau Cog不是类别。 The category is named Urgences Environnementales and titled Urgences_Environnementales . 该类别名为Urgences Environnementales ,名称为Urgences_Environnementales

I tried changing the names of tableau cog everywhere by my category name (respecting the name vs title) but it's still not working. 我尝试通过我的类别名称在任何地方更改tableau cog的名称(尊重名称与标题),但仍然无法正常工作。 I tried creating a new category completly, adding the same code with the new category name and title but it's still not working. 我尝试完全创建一个新类别,并使用新类别名称和标题添加相同的代码,但是仍然无法正常工作。 I see both categories as nested under another category named the same but with a word between parenthesis. 我看到这两个类别嵌套在另一个相同的类别下,但在括号之间加了一个词。 I cehcked everywhere in the code using grep and I cannot find any other tableau_cog nor Environments Urgencies nor the word between parenthesis. 我使用grep遍历了代码中的所有地方,找不到其他tableau_cogEnvironments Urgencies或括号之间的单词。

I am very sorry for my ignorance. 我为自己的无知感到非常抱歉。 I tried all day to understand WordPress, read the code, read the forums, searched but didn't find enough to answer my question. 我整天试图理解WordPress,阅读代码,阅读论坛,进行搜索,但找不到足够的答案。

Oh and I also clicked on update after changing the categories. 哦,更改类别后,我也单击了更新

Also, the report is building itself from one of the categories that has this code inside the choice section: 同样,该报告是根据选择部分中包含以下代码的类别之一构建的:

Synthèse météo / Changements à l'ancien scénario : Synthèse météo / Changements à l'ancien scénario<font color=#00B0F0><b> (Surveillant)</b></font>
Distribution des tâches : Distribution des tâches<font color=#00B0F0><b> (Surveillant)</b></font>
WWCN70 : WWCN70<font color=#00B0F0><b> (Temps Violent)</b></font>
WOCN70 : WOCN70<font color=#00B0F0><b> (Temps Violent)</b></font>
Aperçu Convectif / Temps Significatif : Aperçu Convectif /Temps Significatif
Vigilance J1-2(Confiance-basse-modérée-haute & Impacts possibles) : Vigilance J1-2(Confiance-basse-modérée-haute & Impacts possibles)
Vigilance J3-5+(Confiance-basse-modérée-haute & Impacts possibles) : Vigilance J3-5+(Confiance-basse-modérée-haute & Impacts possibles)
Évaluation des modèles [tendances] : Évaluation des modèles [tendances]<font color=#00B0F0><b> (Temps Violent)</b></font>
71 : 71
72 : 72
73 : 73
74 : 74
75/WWCN75 : 75/WWCN75
Maritime Court-Terme : Maritime Court-Terme
Maritime Long-Terme : Maritime Long-Terme
Qualité de l'air/CAS : Qualité de l'air/CAS
Appels : Appels<font color=#00B0F0><b> (Surveillant/Temps Violents)</b></font>
Problèmes : Problèmes<font color=#00B0F0><b> (Surveillant/Temps Violents)</b></font>
Commentaires : Commentaires<font color=#00B0F0><b> (Surveillant/Temps Violents)</b></font>
Twitter/Facebook : Twitter/Facebook
1-900 : 1-900<font color=#00B0F0><b> (NE/NO la nuit)</b></font>
Climatologie : Climatologie
MSA : MSA
Tableau Cog : Urgences Environnementales<font color=#00B0F0><b> (Surveillant)</b></font>

You can see that the last line have both Tableau Cog and Urgences Environnementales at the same time. 您可以看到最后一行同时具有Tableau Cog和Urgences Environnementales。 I suppose it's done so they use the old variable to with the new name. 我想它已经完成了,所以他们将旧变量与新名称一起使用。

I have no idea on how to do this. 我不知道该怎么做。 Please help if you have an idea. 如果您有想法请帮助。 I'll continue searching for the answer and trying all I can. 我将继续寻找答案,并尽一切可能。

Thanks for your help to all of you. 感谢您对所有人的帮助。

Have a nice day. 祝你今天愉快。

PS: If my question is not clear please tell me. PS:如果我的问题不清楚,请告诉我。 PPS: I added PHP and MySQL in the tags as it may also be a problem in the code/database. PPS:我在标签中添加了PHP和MySQL,因为这可能也是代码/数据库中的问题。

The problem was that the tableau_cog name was not used in the databse. 问题是在数据库中未使用tableau_cog名称。 I changed the names in the code to reflect the names in the database and everything worked. 我更改了代码中的名称,以反映数据库中的名称,并且一切正常。

Thank you cale_b and David for your help. 谢谢cale_b和David的帮助。 Pointing the database as the problem gave me the answer! 指出数据库为问题给了我答案! Everything works now. 现在一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM