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 one time and then afterwards we can easily set/unset that page as our front page anytime without any extra step.
I know there are some solutions floating around like this: How to use a custom post type archive as front page?How to use a custom post type archive as front page?
If I adopt the above-mentioned solution, It'll work but if I decide to change my front page afterwards to something else I'll have to remove/disable this code, in addition. Whereas, in the case of WooCommerce, I don't need this extra step.
My question: How to set archive-portfolio.php
as my front page in the same way as WooCommerce allows us to set archive-product.php
as home page (i.e. without extra step)?