How to define a content function or snippet
Permalink
This must be solved already, but I have not been able to find what I am looking for.
Let's say that each page needs a footer. I want to define the content in the footer as a function or snippet, say footer().
Then I add the function to each page. Then, when the footer changes, I simply go and edit the content of the function, and the whole website is updated.
The scrapbook allows me to add the html easily, but it does not allow a site-wide update. Each footer has to be updated one by one.
How do I get around this?
Kind regards,
wickyd
Let's say that each page needs a footer. I want to define the content in the footer as a function or snippet, say footer().
Then I add the function to each page. Then, when the footer changes, I simply go and edit the content of the function, and the whole website is updated.
The scrapbook allows me to add the html easily, but it does not allow a site-wide update. Each footer has to be updated one by one.
How do I get around this?
Kind regards,
wickyd
Is there anyone that can help? Thanks
Copy the block to the global scrabook rather than the user scrapbook. Here's how I normally do that:
1. Go to Dashboard -> Scrapbook. Create a new scrapbook...call it whatever you want (I usually call mine Global).
2. You can either add the block directly to that scrapbook from that page OR go to a page in the site that already has the block you want, and copy it to the newly created scrapbook from there.
Once you do that, anytime you add the block to a page from the scrapbook, you will be adding the centralized "global" one.
1. Go to Dashboard -> Scrapbook. Create a new scrapbook...call it whatever you want (I usually call mine Global).
2. You can either add the block directly to that scrapbook from that page OR go to a page in the site that already has the block you want, and copy it to the newly created scrapbook from there.
Once you do that, anytime you add the block to a page from the scrapbook, you will be adding the centralized "global" one.
or if your doing this in a theme, use elements...
default.php includes:
/elements/header.php and
/elements/footer.php
so if you edit the footer it changes it on all pages
default.php includes:
/elements/header.php and
/elements/footer.php
so if you edit the footer it changes it on all pages
Hi jgarcia
This answer is perfect, thank you.
This can even be taken a step further, by adding the content block to default.php.
Then when a new page is added, it already has the footer block defined and picks up the content from the scrapbook.
This answer is perfect, thank you.
This can even be taken a step further, by adding the content block to default.php.
Then when a new page is added, it already has the footer block defined and picks up the content from the scrapbook.