I'm using an index.php file under /pub/custom folder, which is used to create custom designs.
This file is completely written in html and javascript.

Is there any way to include current theme header and footer to this file?

For eg: https://example.com/custom/ should include the header and footer from https://example.com

There are so many answers for Magento 1, but I couldn't find anything for Magento 2.
I'm using version 2.1.15. and Porto theme.

Any help would be appreciated! Thanks.

  • I don't think you could include header and footer to html files. – Adarsh Khatri Mar 22 at 4:40
  • @AdarshKhatri It is a .php file, which contain html and javascript. – ASR Mar 22 at 4:41
  • oh! I completely missed that. Is there any reason not using regular index.php? – Adarsh Khatri Mar 22 at 4:44
  • @AdarshKhatri, I don't think I understand that clearly. The /pub/custom folder is a separate section to create custom designs which send an email with finished design. Right now I'm using a "placeholder header and footer". I would like to include the site header and footer with cart and search options. – ASR Mar 22 at 4:53
  • @ASR I do not fully understand the desired end result. Do you want to have an e-mail with the site header and footer? It would be helpful to bring more clearity to which header/footer (email or theme's) you want to include where – CompactCode Mar 25 at 8:50

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.