Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for WP 5.5 get_template args parameter. #40

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

palmiak
Copy link

@palmiak palmiak commented Dec 1, 2020

As mentioned in #39 - get_template_part has a support for $args variable now.

Currently it's not compatible with WP < 5.5. I was thinking a bit about how add such a compatibility - it's possible and would require two things:

  • changing a bit order of parameters to set $args at the end (which is would not be exactly the same as in native get_template_part function)
  • wrap all cases of using methods with $args in a WP version check like
if ( WP_VERSION < 5.5 ) {
do_action( 'get_template_part_' . $slug, $slug, $name );
} else {
do_action( 'get_template_part_' . $slug, $slug, $name, $args );
}

Personally I think that starting a major, breaking version is the better way.

- also depracated the set_ and unset_ template_data, functions.
@kkalbaugh
Copy link

This worked great for me. Thank you @palmiak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants