内容区域在我的页面中未找到,使用Elementor。

huangapple go评论71阅读模式
英文:

content area not found in my page with elementor

问题

我刚开始使用WordPress,几周前发布了一个网站。今天我想编辑首页,但出现了以下错误:

“抱歉,在您的页面中未找到内容区域。您必须在当前模板中调用the_content函数,以便Elementor在此页面上工作。”

我没有编辑首页,几周前它还能正常工作。是否有人可以帮助我解决这个问题?

英文:

I just started with WordPress and I published a website a few weeks ago. Today I wanted to edit the homepage, but I get the following error:

Sorry, the content area was not found in your page. You must call the_content function in the current template, in order for Elementor to work on this page.

I haven't edited my homepage and it worked perfectly a couple of weeks ago. Is there someone that can help me fix this issue?

答案1

得分: 11

如果您在页面上使用任何“shortcode”并在该页面上获取帖子并在while循环中循环遍历帖子,请在循环结束后添加以下内容。不确定为什么,但这总是对我造成问题。

wp_reset_postdata();

代码将如下所示:

$posts = new WP_Query($args);
while ($posts->have_posts()) : $posts->the_post();
  .....
  .....
  .....
endwhile;
wp_reset_postdata();

无论是shortcode还是其他情况,如果我们像上面那样做,请确保添加 wp_reset_postdata();

这是我通常遇到的问题之一。也可能有其他原因。

英文:

If you are using any shortcode on your page and you are fetching post on that page and looping through the post in a while loop. Please add this after the loop ends. No sure why but this always cause issue for me.

wp_reset_postdata();

Code will look like this:

$posts= new WP_Query($args);
while ($posts->have_posts() ) : $posts->the_post();
  .....
  .....
  .....
endwhile;
wp_reset_postdata();

It doesn't matter it's a shortcode or what if we are doing something like above make sure to add wp_reset_postdata();

This is one of the issues that I usually face. There can be other reasons too.

答案2

得分: 1

可能您已经编辑了页面模板,从模板 -> 主题生成器 -> 单页。无论如何,即使您没有,您可以通过以下方式修复它:转到模板 -> 主题生成器 -> 单页 -> 添加新模板,然后选择页面并为所有单页创建一个模板(确保将页面内容小部件拖放到模板中)。这应该会覆盖您的主题单页模板(该模板缺少内容功能)。

英文:

Probably you've edited the page template from Templates -> Theme Builder -> Single. Anyway, even if you don't, you can fix it that way: Go to Templates -> Theme Builder -> Single -> Add New, then select page and create a template for all single pages (make sure that you drag the page content widget in the template). This should overwrite your theme single page template (which misses the content function).

答案3

得分: 1

只需确保您的“主页”和“文章页面”不同,否则页面会混淆,从而导致此错误发生... 对我有用!
您可以在外观>自定义>主页设置中验证此设置 内容区域在我的页面中未找到,使用Elementor。

英文:

Just make sure your 'Home Page' and 'Posts Page' are different, otherwise you get your page mixed up and this error occurs.. Worked for me!
You can verify this setting in Appearance>Customize>Homepage Settings 内容区域在我的页面中未找到,使用Elementor。

答案4

得分: 1

错误的答案是检查您的永久链接结构。尝试再次保存您的永久链接。此外,尝试将永久链接结构更改为“普通”。一些服务器不允许写入.htaccess文件,实际上,您不能始终修改您的永久链接结构并使用Elementor进行编辑。

英文:

The Answer to this error is to check the structure of your permalinks. Try to save your permalinks one more time. Also, try to change the permalink structure to “Plain”. Some servers do not allow to write to the .htaccess file and as a matter of fact, you cannot always modify your permalink structure and edit with Elementor.

答案5

得分: 0

我昨天发现自己在同样的地方,一时间感到惊慌,并进行了一些研究,以找出为什么我会收到这个错误,并偶然发现了这个页面。相信我,这是因为艾德·琼斯上面提到的情况,我无意中编辑了帖子模板。但一个快速而简单的解决方法是返回到我历史记录中的页面的早期版本。那很快解决了我的问题。

英文:

I found myself in the same place yesterday and freaked for a moment and did some research to find out why I was receiving the error and came across this page. Believe for me it occurred due to the situation Ed Jones posted about above, I had inadvertently edited the post template. But a fast and easy fix was to go back to an earlier revision of the page in my history. That solved my problem quickly.

答案6

得分: 0

在你的模板末尾添加 the_content()

英文:

Add the_content() at the end of your templates

内容区域在我的页面中未找到,使用Elementor。

答案7

得分: 0

当我遇到这个问题时,是页面内的 slug 更改了。那真的很奇怪,我不知道为什么会这样发生。但这可能对某人有帮助!

英文:

When I had this issue, it was a slug change within the page. That was so weird and I don't know why it happened that way. But this may help someone!

huangapple
  • 本文由 发表于 2020年1月3日 19:10:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/59577543.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定