Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Wrap theme functions inside function_exists() check#1277

Closed
pattonwebz wants to merge 1 commit intoAutomattic:masterfrom
pattonwebz:issue/1116
Closed

Wrap theme functions inside function_exists() check#1277
pattonwebz wants to merge 1 commit intoAutomattic:masterfrom
pattonwebz:issue/1116

Conversation

@pattonwebz
Copy link
Copy Markdown

Changes proposed in this Pull Request:

This PR wraps theme functions inside of function_exists().

NOTE: /inc/woocommerse.php functions are not currently wrapped.

Related issue(s):

#1116

@pattonwebz
Copy link
Copy Markdown
Author

@davidakennedy The woocommerse.php file in the theme uses a different format for the if statements wrapping the function check than what was already used throughout the rest of the theme. That file uses if () {..} style wrappers where as the rest of the theme uses if () : endif;.

Should I normalize all the calls to be the same syntax and if so which method would be preferable?

@samikeijonen
Copy link
Copy Markdown
Contributor

I think current standard is to use if () : endif; in template files, and if () {..} in other files.

@pattonwebz
Copy link
Copy Markdown
Author

@samikeijonen sorry, I missed the notification for this comment when you made it somehow 😕.

Do you think I should go ahead and wrap the functions from woocommerse.php inside if () {..} style checks then?

@grappler
Copy link
Copy Markdown
Contributor

grappler commented Apr 2, 2018

As I mentioned in the issue #1116 (comment) I don't agree with making all functions pluggable.

@pattonwebz
Copy link
Copy Markdown
Author

@grappler so your preference is that only a small number (those which cannot be unhooked or support removed easily) should be overloadable?

I can do that if that's what is called for but you'll need to let me know what the list of functions to wrap are because people have different opinions on what is considered easily removed lol

@grappler
Copy link
Copy Markdown
Contributor

grappler commented Apr 2, 2018

so your preference is that only a small number (those which cannot be unhooked or support removed easily) should be overloadable?

Yes that would be my preference.

I can do that if that's what is called for but you'll need to let me know what the list of functions to wrap are because people have different opinions on what is considered easily removed lol

The steps that are needed would be #1116 (comment)

I am not sure how to come to a decision or who makes the final decision..

@philiparthurmoore
Copy link
Copy Markdown
Contributor

Agree completely with @grappler's take on this.

@Ismail-elkorchi
Copy link
Copy Markdown
Contributor

Hi @pattonwebz 👋 ! Would you be still interested in updating this PR ? If not, no worries, I can pick up the work where you left off if you want, just let me know.

@kangabell
Copy link
Copy Markdown

I'd find this change helpful!
@Ismail-elkorchi I see that @pattonwebz has not responded – are you still interested in picking this up?

@Ismail-elkorchi
Copy link
Copy Markdown
Contributor

@kangabell of course. I'll look it over today or tomorrow at the latest. thanks for the reminder :)

@Ismail-elkorchi
Copy link
Copy Markdown
Contributor

I have created a new PR #1480 to adress this issue based on #1116 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

6 participants