Global variables

Add a form to define global variables that could be reused with PHP in the whole site.

Is this not rather in settings. Something like the header and footer scripts? I like WPCodeBox (code complete etc.) for such things… or WPSnippets. Global CSS variables is already possible if I am not mistaken…

The variable that I want to be set is to be used with PHP in the whole site and so through all posts. In a site I developped, I added a field in “Wordpress Settings > General” (previously added in the table “Options”) that the administrator could change via an editable input field I added in general settings Then, in an archive, in the loop, I added a test with calculation on the published date + the variable (e.g.: 3m). This was the only method I found to make this kind of calculation.
This could be done via PHP snippet, but it would be more elegant and easier via Cwicly settings.

It’s a to niched use case to be part of the builder.
Plus you could do this with ACF. (the number field is basically a integer so you can store you values in it and use it for calculations)

With ACF, the value is attached to each post and if the variable must change it is needed to change in each post! the goal is to change once and it is applied in the loop to all the posts. This cannot be achieved with ACF. In my site it was a calculation on dates but it can be used to calculate a VTA, a percentage, etc.
I do agree that it is a niche but it worth to ask and if the job to add this feature is not so hard, perhaps the Cwicly team will add it in the roadmap.

You can use Options pages with ACF, to have a centralized page instead of per posts. (and those values are global)
For more info: ACF | Options Page (advancedcustomfields.com)

1 Like

My bad, you are right! I didn’t know this ACF feature. Thank you to let me know it.
It seems to be a bit complicate to run, but I will dig out.
It is really unnecessary to add this feature in Cwicly because of redondant one.