0

Setting up a new wordpress site at the moment separating wp_core from wp_content. I'm using timber and twig for my views/templates.

My current project structure is:

\ core (wp_core)
|- \ content
   |- \ mu-plugins
   |- \ plugins
   |- \ themes
   |- \ uploads

All plugins etc are working fine and wp is picking up the theme, using it perfectly. My content/themes then goes on to be structured like so:

|- \content
   |- \theme_name
      |- \ acf_json
      |- \ config
      |- \ templates
      |- \ views

All of my templates are stored in views and all my twigs are stored in templates. I have set up a home page which uses a custom template (views/page-landing.php) and using breakpoints I can see that when I go to the home page of the site it hits the break point and when continued it presents the correct data.

I have also set up a custom post type called project/projects. In order to list the projects I have created an views/archive-project.php file and set the custom post type to use archives.

But unfortunately when i try going to http://example.com/project I just get a blank screen and the breakpoint doesn't get hit. This is happening on all other templates except ones that I explicitly set on a page when creating it. e.g. taxonomy/archive/single not working.

EDIT After step debugging more i know that wordpress is looking for the correct file e.g. archive-project.php, but what it is not doing is looking in the views sub directory so for instance if I move archive-project.php into the theme root directory it works perfectly but in the subdirectory of views wordpress doesn't find it. After researching it seems wordpress should be doing this since WP 3.4.

  • We had the problem, that WP did not go deep enough when searching for overwritten theme files. This depth-limit could still be there. – LeMike Mar 10 '15 at 12:05
  • This might be highly specific to how your theme works. Can you confirm this behavior in a vanilla WP install with no plugins involved and one of the default themes? – kaiser Mar 10 '15 at 12:23
  • 1
    I actually think it's because wordpress WILL look into sub-directories for custom templates which you set for normal pages but for templates like archive-,taxonomy-,single- it will always look in the theme root – Tom Burman Mar 10 '15 at 12:26
  • 1
    Again: Can you confirm that this works with a vanilla install and no plugins and a default theme? Guessing games are better kept else where and not in the programming world :) – kaiser Mar 10 '15 at 12:28
  • 1
    That's what im saying yes in default themes having PAGE templates in a sub directory will be picked up but other templates for archive,single and taxonomy are always on root of the theme so it works, trying to move them into a subdirectory in the default theme/no plugins/vanilla then it also doesn't work as it isnt in my theme – Tom Burman Mar 10 '15 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.