Hello wordpress gurus!
I want to be able to set the frontpage via a custom field.
So for example, in the new page area in the wordpress admin there is a custom field that displays “Set as frontage”, instead of the user going to the Settings > Reading settings and setting the front page there they can do it via the new page.
I’m familiar with metaboxes and some coding but i’m not sure how i could implement this.
I also found this article on setting the front page programatically:
http://kuttler.eu/code/set-static-front-page-and-blog-page-programmatically-in-wordpress/
Its just the matter of putting it together with the custom field.
Help appreciated.
Thanks
You can do it by updating 2 options.
Though I cannot guarantee if this is safe and whether it will override the settings saved from the backend!
First things first – the front page is a system wide setting (by definition). Using a post meta is not the right choice. That said, you can use metaboxes to update the options itself. What you may want to do is to display a meta box that displays the current front page and also allows the user to set the current page as the front page from your metabox.
Have a look at options-reading.php to see what keys are used for front page and blog page.