Hi folks,
I am facing a problem with the template overrides within the “WP Job Manager” Plugin and sage 9.
The default location should be in views
, but the Plugin gets the template from ressources
or a subfolder in it:
This works:
sage/resources/content-resume.php
or
sage/resources/wp-job-manager-resumes/content-resume.php
But should´t it in views folder, like this?
sage/resources/views/content-resume.blade.php
or
sage/resources/views/wp-job-manager-resumes/content-resume.blade.php
or even better
sage/resources/views/partials/content-resume.blade.php
Also it is not possible to use blade, only plain php.
These are the plugin functions to search for templates:
/**
* Gets and includes template files.
*
* @since 1.0.0
* @param mixed $template_name
* @param array $args (default: array())
* @param string $template_path (default: '')
* @param string $default_path (default: '')
*/
function get_job_manager_template( $template_name, $args = array(), $template_path = 'job_manager', $default_path = '' ) {
if ( $args && is_array( $args ) ) {
extract( $args );
}
include( locate_job_manager_template( $template_name, $template_path, $default_path ) );
}
/**
* Locates a template and return the path for inclusion.
*
* This is the load order:
*
* yourtheme / $template_path / $template_name
* yourtheme / $template_name
* $default_path / $template_name
*
* @since 1.0.0
* @param string $template_name
* @param string $template_path (default: 'job_manager')
* @param string|bool $default_path (default: '') False to not load a default
* @return string
*/
function locate_job_manager_template( $template_name, $template_path = 'job_manager', $default_path = '' ) {
// Look within passed path within the theme - this is priority
$template = locate_template(
array(
trailingslashit( $template_path ) . $template_name,
$template_name
)
);
// Get default template
if ( ! $template && $default_path !== false ) {
$default_path = $default_path ? $default_path : JOB_MANAGER_PLUGIN_DIR . '/templates/';
if ( file_exists( trailingslashit( $default_path ) . $template_name ) ) {
$template = trailingslashit( $default_path ) . $template_name;
}
}
// Return what we found
return apply_filters( 'job_manager_locate_template', $template, $template_name, $template_path );
}
/**
* Gets template part (for templates in loops).
*
* @since 1.0.0
* @param string $slug
* @param string $name (default: '')
* @param string $template_path (default: 'job_manager')
* @param string|bool $default_path (default: '') False to not load a default
*/
function get_job_manager_template_part( $slug, $name = '', $template_path = 'job_manager', $default_path = '' ) {
$template = '';
if ( $name ) {
$template = locate_job_manager_template( "{$slug}-{$name}.php", $template_path, $default_path );
}
// If template file doesn't exist, look in yourtheme/slug.php and yourtheme/job_manager/slug.php
if ( ! $template ) {
$template = locate_job_manager_template( "{$slug}.php", $template_path, $default_path );
}
if ( $template ) {
load_template( $template, false );
}
}
How to handle these templates overrides with sage to use blade engine?
Thank you!