Aucune description

template.php 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /*******************************************************************************
  3. * Copyright (c) 2019, Code Atlantic LLC
  4. ******************************************************************************/
  5. if ( ! defined( 'ABSPATH' ) ) {
  6. exit; // Exit if accessed directly
  7. }
  8. /**
  9. * Get a templates part in $slug-$name.php fashion.
  10. *
  11. * Allows passing arguments that will be globally accessible in the templates.
  12. *
  13. * @param string $slug
  14. * @param string $name
  15. * @param array $args
  16. *
  17. * @return string
  18. */
  19. function pum_get_template_part( $slug, $name = null, $args = null ) {
  20. return PUM_Utils_Template::get_part( $slug, $name, $args );
  21. }
  22. /**
  23. * Render a templates part in $slug-$name.php fashion.
  24. *
  25. * Allows passing arguments that will be globally accessible in the templates.
  26. *
  27. * @param string $slug
  28. * @param string $name
  29. * @param array $args
  30. */
  31. function pum_template_part( $slug, $name = null, $args = array() ) {
  32. echo pum_get_template_part( $slug, $name, $args );
  33. }
  34. /**
  35. * Gets the rendered contents of the specified templates file.
  36. *
  37. * @param $template_name
  38. * @param array $args
  39. *
  40. * @return string
  41. */
  42. function pum_get_template( $template_name, $args = array() ) {
  43. return PUM_Utils_Template::get( $template_name, $args );
  44. }
  45. /**
  46. * Get other templates (e.g. product attributes) passing attributes and including the file.
  47. *
  48. * @deprecated Likely a better way @see pum_template_part()
  49. *
  50. * @param string $template_name Template file name with extension: file-name.php
  51. * @param array $args (default: array())
  52. */
  53. function pum_load_template( $template_name, $args = array() ) {
  54. echo pum_get_template( $template_name, $args );
  55. }