-1

I am creating a Wordpress custom theme, and I've been having issues with my woocommerce template rendering. Firstly, not all of the pages are showing up (some of them are reverting to the index.php and page.php files). Secondly, for the pages that are showing up (the single product page, the archive products page), the css is not being applied. I have tried everything suggested on the docs (hooks), but I have failed. Here is a link to my github for you to see the file structure.

https://github.com/naderae/elbe-collections

possible issues wuth my code:

my code is not written in the standard wordpress way. I only have three pages so far, index.php, page-about.php, and page-team.php, which work fine. page.php and single.php are empty. thus, my site consists of 2 pages, and index.php.

I've been struggling with this for 2 days, and would really appreciate some guidance of hoe to get me back on track. Cheers

2
  • I have seen you posted same question many times. I checked source files and your theme structure is not up to the standards. No body class, even no loop in any template. I would recommend you to see deault twentyseventeen theme and its template structure, specially index.php, page.php, single.php Nov 9, 2018 at 0:39
  • @AhmadHassan I have changed the file structure, and included all the necessary files and loops. Still having the same problem. any suggestions? the updated code is in the git repository.
    – Nader
    Nov 10, 2018 at 2:43

2 Answers 2

1

Below is a list of some basic theme templates must preset in theme, more about this in details click here.

  • index.php
  • style.css
  • header.php
  • single.php
  • page.php
  • category.php
  • archive.php
  • 404.php

I would recommend you to start with some default WordPress theme like twentyseventeen theme or other. These themes will have all basic functionality of WordPress. Check functions.php in the theme folder to customize/add functionality.

for more details about Template Hierarchy click here

Customize WooCommerce

  • Template structure & Overriding templates via a theme - link
  • Customizing WooCommerce - link
4
  • I have changed the file structure, and included all the necessary files. Still having the same problem. any suggestions? the updated code is in the git repository at github.com/naderae/elbe-collections
    – Nader
    Nov 10, 2018 at 16:33
  • page.php is the general file which shows all pages if no template assigned. I found that your page.php has the code statement get_template_part( 'template-parts/page/content', 'page' ); there is no template-parts folder in your theme. if no such file then simply replace the statement with the_content(); Nov 10, 2018 at 16:59
  • all the pages are showing up now! however ,there no being applied to them. do you know why this could be? thanks for you responses, very helpful
    – Nader
    Nov 10, 2018 at 17:42
  • open all files and clean the code. In order to make a page entirely different from the default page use custom template. do not write everything in page.php or single.php Nov 12, 2018 at 4:42
0

To overwrite woocommerce css you need to add a woocommerce folder to your theme. And go from there. Woocommerce will also always use their own templates so the easiest way to change the layout is to use a child-plugin from woocommerce.

2
  • I have changed the file structure, and included all the necessary files. Still having the same problem. any suggestions? the updated code is in the git repository at github.com/naderae/elbe-collections
    – Nader
    Nov 10, 2018 at 16:33
  • In order to change Woocommerce you must create a folder in your theme called 'woocommerce' if you put woocommerce.php in root folder of your theme it will not have effect. Also, when you want to change for example templates from the woocommerce/templates folder. You must put all those files in the woocommerce folder inside your theme. Do not create woocommerce/templates... But put everything in the "woocommerce" folder inside your theme. You find more information here... docs.woocommerce.com/document/template-structure Nov 11, 2018 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.