soflyy / oxygen-bugs-and-features

Bug Reports & Feature Requests for Oxygen
https://oxygenbuilder.com/
314 stars 29 forks source link

Global Function.php #40

Open linformatique opened 5 years ago

linformatique commented 5 years ago

Since Oxygen is a plugin and not a theme it would be an important feature to add a global Function.php instead of localized PHP or adding another plugin that might be or might become incompatible with Oxygen.

This would permit us to add PHP in one central area for global coverage.

wplit commented 5 years ago

Not ideal because as Oxygen updates to a new version, all your functions will be removed (similar to themes, that's why child theming is a thing). With Oxygen, using your own custom plugin to store functions or using code snippets plugin is the recommended way.

trey8611 commented 5 years ago

@wplit if they store the functions.php file in an uploads folder like /wp-content/uploads/oxygenapp then it will not be overwritten when Oxygen is updated.

PaperjetStudios commented 5 years ago

To be honest, I don't agree with this one - it's super easy already to add your own custom functionality plugin, and keep your code the way you want to.

cliffordp commented 5 years ago

I haven't looked at the code... Is there an Oxygen wrapper function like "if_oxygen_active()"?

guyinpv commented 5 years ago

I haven't looked at the code... Is there an Oxygen wrapper function like "if_oxygen_active()"?

Yes, there is a way to simply test of some primary Oxygen function exists first before writing more code. I forget where I read it though, somewhere in the docs for creating your own plugins, you can test for Oxygen function first.

shoelaced commented 4 years ago

Unless there ends up being some kind of cool "code snippets" organizer in there somewhere, which I might be on board with, I'm not sure I would write actual functions within Oxygen, given that if I have to do that in the first place then I might want to be able to install them on other sites as well. However, it would be awesome if it supported common filters, so that, for example, we wouldn't have to go create a whole separate plugin just to do something small like changing the number of words in the excerpt.

Also in the past I've checked whether Oxygen is active by checking whether one of its main constants is defined and that seems to work well.

guyinpv commented 4 years ago

I propose that Oxygen simply make available a custom plugin bootstrap that people can use to quickly begin adding some custom code. It can have a very basic class setup, test that Oxygen is active or not, provide a few empty common functions/filters/actions or whatever.

Most all WP sites are going to have at least a few bits of custom PHP, so it seems a natural choice to just have a solid starter custom plugin ready to use.