Jump to content

Scheduled Content Changes?


johnners
 Share

Recommended Posts

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

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

?>

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...