johnners Posted November 30, 2022 Share Posted November 30, 2022 Hi Guys, I'm wondering if there is a way to change the "Body" content on my home page. I'm looking at doing it at 01:00 01/01/23 and I will have the new content all written. Is there a good way to be able to specify the body content needs to change at the specified time/date? Thanks Drew Link to comment Share on other sites More sharing options...
johnners Posted November 30, 2022 Author Share Posted November 30, 2022 I'm almost thinking if there is a way to replace the content of the body field in the database using a cronjob - if there is no other alternative? Link to comment Share on other sites More sharing options...
Gideon So Posted November 30, 2022 Share Posted November 30, 2022 Hi @johnners 1. Create a new template whatever name you think fit, such as update-home-body. 2. Create a page and assign the template created above to it. 3. Create a new template php file named the same name as the template created in step 1 such as update-home-body.php in the site/template folder. 4. Put the following code in the template file. <?php $home = $pages->get(1); $home->of(false); $content = "whatever you want or read it from somewhere"; $home->body = $content; $home->save(); 5. Create a cron job to access the page at the designated time. Hope this helps. Gideon ?> 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now