/** * Retrieves a template part * * @since v1.0 * * Taken from bbPress * * @param string $slug * @param string $name Optional. Default null * @param bool $load * * @return string * * @uses give_locate_template() * @uses load_template() * @uses get_template_part() */ function give_get_template_part($slug, $name = null, $load = true) { // Execute code for this part do_action('get_template_part_' . $slug, $slug, $name); // Setup possible parts $templates = array(); if (isset($name)) { $templates[] = $slug . '-' . $name . '.php'; } $templates[] = $slug . '.php'; // Allow template parts to be filtered $templates = apply_filters('give_get_template_part', $templates, $slug, $name); // Return the part that is found return give_locate_template($templates, $load, false); }
public function test_locate_template() { // Test that a file path is found $this->assertInternalType('string', give_locate_template('history-donations.php')); }