Gamajo-Template-Loader icon indicating copy to clipboard operation
Gamajo-Template-Loader copied to clipboard

Added support for WP 5.5 get_template args parameter.

Open palmiak opened this issue 4 years ago • 1 comments

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.

palmiak avatar Dec 01 '20 01:12 palmiak