2017 © Pedro Peláez
 

library template-part-args

A handy WordPress library to get image src with crop options.

image

mentormate/template-part-args

A handy WordPress library to get image src with crop options.

  • Tuesday, November 21, 2017
  • by yuki
  • Repository
  • 0 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Template Part Arguments

An alternative to native Wordpress function get_template_part that allows passing of arbitrary arguments to the template partial., (*1)

How to use

There are two template functions exposed by the plugin - get_template_part_args and get_template_part_vars. The former is used in place of get_template_part, i.e. to pass the arguments and the latter is used to retrieve them in the template partial., (*2)

Here's an example:, (*3)

// Anywhere in your theme templates
get_template_part_args( 'template', 'part', [ 'example_argument' => true ] ); 

```php // in template-part.php, (*4)

// define defaults $defaults = [ 'example_argument' => false, ];, (*5)

// combine defaults with passed args $args = wp_parse_args( get_template_part_vars( $this ), $defaults );, (*6)

The Versions

21/11 2017

dev-master

9999999-dev

A handy WordPress library to get image src with crop options.

  Sources   Download

GPL-2.0+

wordpress image src

21/11 2017

1.0

1.0.0.0

A handy WordPress library to get image src with crop options.

  Sources   Download

GPL-2.0+

wordpress image src