Mazgorta
Forum Replies Created
-
I made a mistake at the end of the previous post… We must create two file named: “archive-producto.php” and “archive-portfolio.php” (archive-CPT NAME.php) to show the content of parent archive page.
Thanks
Hi,
After many headaches, I’ve spent days and hours finding a solution. I’ve find a solution for two problems commented above. I hope it helps to someone:
**PROBLEM 1**:
I realized that when I changed Permalink to Plain (wordpress admin > settings > permalink > Plain) and when I click in Breadcrumb link “iluminacion interior” it works OK (no more 404 error page). I tried the same in others subcategory’s archive page and It works OK also. But I want “pretty permarlinks” I don’t want this kind of url: Root_domain/?producto=crea-ambientes-interior-acogedores, so I’ve rewritten “/%category%/%postname%.html” in permarlinks > Custom Structure.
So the problem was that servers doesn’t understand “pretty permalinks: /%category%/%postname%.html”, then servers returns 404 error in subcategory’s archives page when WordPress request this kind of url:
Root_domain/productos-decoracion/iluminacion/iluminacion-interior
To solve the problem I’ve added $newRules in function mmp_rewrite_rules in function.php, so the servers can understand WordPress requests. This is the new function mmp_rewrite_rules code.
I’ve done the same for the other CPT Proyectos.**PROBLEM 2**:
This problem was easier to solve. I replace‘has_archive’ => true,for‘has_archive’ => ‘productos-decoracion’, inmy_custom_post_product()function. ’productos-decoracion’ is the slug for the parent archive page. I do the same with proyectos CPT.
Now parent archive page url will be: …/productos-decoracion, no more …/productos-decoracion/%field%. Now we must create two file named: “archive-productos-decoracion.php” and “archive-proyectos.php” to show the content of parent archive pages.
That’s all.