hello
I have made modifications in the file template-functions.php, since in the admin there is a text asking to execute the installation (setup)....
Why am i seeing this and what should i do? this is kind of scary as i do not want to re-install anything...
thanks
Pat
Comments
It is strongly recommended not to modify any file in the `zp-core` folder!
If you want to change a function, copy and rename the function and put it into a file called `functions.php` in your theme folder.
Then you can call your new function anywhere you like in your theme.
EDIT
In case you didn't know, Zenphoto will detect if there is a `functions.php` file present in your theme folder.
There is no need to "include" it in your theme pages.
It is also recommend in the theming tutorial. You also should make a copy of the theme under a new name for the same reason. Of course you can never be kept from some maintenaince if things change over time.
Leave the original file (i.e. template-function.php) unchanged.
you mean, i should copy the modified function under another name? but this imply to modify every single file where the function is called !
I have no idea how many instances i should modify or where they are called !
1) Copy the function you want to modify
(in your case one of the functions in `template-function.php`)
2) Paste the function in a file called `functions.php` (located in your theme folder)
3) Rename the pasted function.(in `functions.php`)
Otherwise you will get conflicts with the original function
in `template-function.php`.
4) Do whatever you like with it.
You NEVER should modify core functions. That are all functions that belong to Zenphoto and are in the file in /zp-core. You can do that on your own risk of course. First, if you do that and you get problems you are on your own as we alway will refer to the original behaviour. Second, you will have to do this on every Zenphoto update. Similar of course for plugins.
So instead you copy the function in question, rename it (so printRandomImage() would be something like printMyRandomImages()), place it in your theme functions.php (or your own custom plugin) and modify it to your liking. Then you use that function on your theme instead the original. And yes of course you need to replace all usages if you want to use your own function. In any case you have to maintain your changes since things can change on updates, too.
Edit: Fretz was quicker and shorter ;-)
That's why i was suprised.
You can of course also create your own classes as wrappers or maybe use namespaces in your theme functions.php then you don't need to rename the functions itself. But still you need to separate them from the originals.