Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add <?php the_content(); ?> to WooCommerce page template

I use Elementor page builder on my WordPress site. There is a problem with it - by default it doesn't allow editing WooCoomerce Shop/Products pages. The solution they say is to add to page templates code. I, being a beginner with no idea of coding, cannot figure out which file to add this code to and where in that file. I have been researching and trying to fix this myself for two weeks now, in vain. Please help me achieve this.

Here's what Elementor say: "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."

like image 540
Gopal Chhetri Avatar asked Sep 26 '16 12:09

Gopal Chhetri


2 Answers

  1. Go to Elementor setting and then check products in post types
  2. Go to Products, click Edit on the product you want to edit, input something (ie. a full stop-sign '.') in the WP Editor, click Update. (See attached screenshot.) Screenshot
like image 123
Kim K Avatar answered Sep 28 '22 01:09

Kim K


There seems to be a misconception that Elementor can be used to "edit" any content.

For Elementor to work on a "Page" i.e. the post type that uses either the page.php or any theme declared page templates it requires the_content(); function to present in the code.

Issue #1: WooCommerce uses the woocommerce_content(); function to return the content of the shop.

Issue #2: The Shop output does not use the "Page" or Custom Page template - the output is equivalent to the index.php or home.php, neither of which are editable via Elementor.

Unless you are willing to write a pretty sophisticated function to collect all those elements' data and filter them into the_content(); function, there is currently no way of editing such content directly.

I know it's not the solution you are looking for but that is the current state of affairs. Having said that, some of us are working on all sorts of solutions and maybe, just maybe - we'll come up with a way to have this option available soon ;)

like image 33
Zulfikar Nore Avatar answered Sep 28 '22 02:09

Zulfikar Nore