I've registered a custom post type named portfolio
and have coded it's respective archive-portfolio.php
file. Now, my requirement is to make this page available to be set as front page. For which I want to adopt the same approach as WooCommerce has adopted, it allows us to assign any static page to products archive page and then we can easily set that page as our front page.
I know there are some solutions floating around like this: How to use a custom post type archive as front page?
If I adopt above mentioned solution, It'll work but if I decide to change my front page afterwards to something else I have to remove this code (or at least have to define a custom controller in customizer to enable/disable this functionality). Whearas, in case of WooCommerce I don't need this extra step.
My question: How to set archive-portfolio.php
as my front page in same way as WooCommerce allows to set archive-product.php
as home page (i.e. without extra step)?