예제 #1
0
 /**
  * Return the field handle.
  *
  * @since 0.1.0
  * @return string The field handle.
  */
 public function handle()
 {
     $handle = $this->_handle;
     if ($this->_bundle !== false) {
         if ($this->_repeatable === false) {
             $handle = str_replace('[', '][', $handle);
             $handle = ev_string_ensure_left($handle, '[');
             $handle = ev_string_ensure_right($handle, ']');
             $handle = sprintf('%s%s', $this->_bundle, $handle);
         } else {
             $handle = sprintf('%s[%s][]', $this->_bundle, $this->_handle);
         }
     } elseif ($this->_repeatable !== false) {
         $handle .= '[]';
     }
     return $handle;
 }
예제 #2
0
/**
 * Get contents from a partial template. If we're in a child theme, the
 * function will attempt to look for the resource in the child theme directory
 * first.
 *
 * @since 0.1.0
 * @param string $file The template file.
 * @param array $data The data array to be passed to the template.
 * @param boolean $echo True to echo the template part.
 * @return string
 */
function ev_get_template_part($file, $data = array(), $echo = true)
{
    $file = ev_string_ensure_right($file, '.php');
    $path = locate_template($file);
    return ev_template($path, $data, $echo);
}