Pourquoi the_content () n'affiche-t-il pas le contenu?
-
-
Quelest le code qui l'entoure?Êtes-vous dans laboucle?What is the code that surrounds that? Are you in the loop?
- 2
- 2012-03-02
- mor7ifer
-
Quelthème utilisez-vous?S'il s'agit d'unthèmepersonnalisé,nous auronsbesoin de voir le * codepersonnalisé *pour lefichiermodèleen question.What Theme are you using? If it is a custom Theme, then we will need to see the *custom code* for the template file in question.
- 0
- 2012-03-02
- Chip Bennett
-
J'aieu un de cesproblèmes.Je crois que cela seproduiten raison d'un autre WP_Queryeffectué avantthe_content ().I got on one of those problem. I believe it occurs due to a another WP_Query made before the_content().
- 0
- 2012-03-02
- ifdion
-
M'est arrivé lors de lamise àniveau vers WP5Happened to me when upgrading to WP5
- 0
- 2019-06-28
- Fanky
-
Jene saispaspourquoi celaestmarqué commepeu susceptible d'aider lesfuturs visiteurs - c'est unebonne questionet des réponses utiles.Celane semblepasplus "extraordinairement étroit" quetoute autre question sur WordPress Stack Exchange.I don't why this is marked as unlikely to help future visitors - it's a good question and has useful answers. This doesn't seem any more "extraordinarily narrow" than any other question on WordPress Stack Exchange.
- 0
- 2020-07-31
- JohnG
-
3 réponses
- votes
-
- 2012-03-02
Pour utiliser "the_content ()",il doit être utilisé dans The Loop.
Voirici: http://codex.wordpress.org/Function_Reference/the_content
"Affiche le contenu dumessage actuel. Cettebalise doit être dans The_Loop."
In order to use "the_content()" it must be used within The Loop.
See here: http://codex.wordpress.org/Function_Reference/the_content
"Displays the contents of the current post. This tag must be within The_Loop."
-
c'est un single.phpet cela afonctionné avantits a single.php and it worked before
- 0
- 2012-03-02
- srisar
-
mais alors commentfonctionne $post->post_content?deplus,the_title ()fonctionne également.but then how $post->post_content works? plus, the_title() also works..
- 4
- 2012-03-02
- srisar
-
Même single.php doit avoir The Loop dessuspour récupérer le contenuet les valeurs de champmétapersonnalisées.Quant àthe_title () [sije neme trompepas]est un champtoujours défini.Vousne pouvezpaspublier un article sans untitre.Pour êtretechniquement correctet WP correct,the_title () devrait également être dans The Loop. Si vous êtes contre l'utilisation de The Loopet que $post->post_contentfonctionne,vouspouveztoujours utiliser lafonction apply_filters ()pour afficher le contenu.http://codex.wordpress.org/Function_Reference/the_content#Alternative_UsageEven single.php needs to have The Loop on it to retrieve the content and custom meta field values. As for the_title() [if I'm not mistaken] is an always defined field. You can't have a published post without a title being input. To be technically and WP correct, the_title() should be within The Loop as well. If you're against using The Loop and $post->post_content works, you could always use the apply_filters() function to display the content. http://codex.wordpress.org/Function_Reference/the_content#Alternative_Usage
- 0
- 2012-03-02
- The Z Man
-
merci,pour votre réponse,je me suis simplement demandépourquoi cela a cessé defonctionner,celafonctionnait avant.entout casmerci,sije trouvemafaute,je posterai sûrementicipour que celapuisse aider quelqu'un.thanks, for your reply, I just wondered why it stopped working, it did worked before. anyway thanks, if I found my fault I will surely post here so it might help someone.
- 0
- 2012-03-02
- srisar
-
Pas deproblemo srisar!Bonne chancepour l'avenir.Si voustrouvez unemeilleure solution ou réponse,oui,veuillez laposterici :)No problemo srisar! Best of luck going forward. If you find a better solution or answer, yes, please post it back here :)
- 0
- 2012-03-02
- The Z Man
-
dommage que celane fassepluspartie de lapage doc ...too bad that's no longer part of the doc page ...
- 0
- 2018-11-12
- Benjamin
-
- 2012-03-02
Si celafonctionnait auparavant,c'estprobablement unplugin qui se connecte aufiltre_content.Désactivez vosplugins unpar unpour voir si cela résout leproblème.Ensuite,vérifiez lesfonctions de rappelpour lefiltre
the_content
.Vouspouvez voir chaque rappelpourthe_contenten ajoutant ce qui suit:
add_action('template_redirect', 'wpse_44152_template_redirect'); function wpse_44152_template_redirect(){ global $wp_filter; print_r($wp_filter['the_content']); }
Trouvez chacune desfonctions répertoriéesen effectuant une recherche de code «rechercher dans lesfichiers» dans votre éditeur de code.Un rappel defiltre DOIT renvoyer des données $ contentpour quethe_content ()fonctionne correctement.
If it worked before, it's probably a plugin hooking into the_content filter. Disable your plugins one by one to see if this fixes the issue. Next, check the callback functions for
the_content
filter.You can see every callback for the_content by adding the following:
add_action('template_redirect', 'wpse_44152_template_redirect'); function wpse_44152_template_redirect(){ global $wp_filter; print_r($wp_filter['the_content']); }
Find each of the functions listed by doing a 'find in files' code search on your code editor. A filter callback HAS TO return $content data back for the_content() to work properly.
-
- 2012-11-26
vouspouvez vérifier votrefunctions.php dans votre dossier dethème,trouver si unefonctionfait quelque chosepour lafonction "the_content". Lethème de lafonction "the_content" a lemêmeproblème,et j'aitrouvé qu'unefonction a uneerreuret que "the_content"peut 'ttravail
trouver dutexte comme "the_content" dans votrefunctions.php,
you can check your functions.php in your theme folder,find if some function do something for the "the_content" function.my theme have the same problem,and I found a function has a mistake and cause "the_content" can't work
find text like "the_content" in your functions.php,
dansmon site wordpress,the_content ()n'affichepas le contenu,mais $post->post_content lemontre,pourquoi cela seproduit-il?et commentpuis-je utiliser ànouveauthe_content?