Hi,
ich möchte gerne ein Woocommerce Plugin aufbauen was die myaccount Seite anpasst.
Mein Problem ist nur sobald im Them Ordner ein woocommerce Ordner ist ignoriert er mein plugin
Wie kann ich die Reihenfolge anpassen das zuerst die plugin Dateien genommen werden (wenn diese aktiv sind) und dann erst vom Template
Normalerweise:
- theme/template path/template name
- theme/template name
- default path/template name
ich brauche:
- addon plugin/template/woocommerce/template name
- theme/template path/template name
- theme/template name
- default path/template name
für diese Reihenfolge hab ich folgendes gefunden.
- theme/template path/template name
- theme/template name
- addon plugin/template/woocommerce/template name
- default path/template name
hab ich folgendes gefunden
PHP
add_filter( 'woocommerce_locate_template', 'woo_adon_plugin_template', 1, 3 ); function woo_adon_plugin_template( $template, $template_name, $template_path ) {
global $woocommerce;
$_template = $template;
if ( ! $template_path )
$template_path = $woocommerce->template_url;
$plugin_path = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/template/woocommerce/';
// Look within passed path within the theme - this is priority
$template = locate_template(
array(
$template_path . $template_name,
$template_name
)
);
if( ! $template && file_exists( $plugin_path . $template_name ) )
$template = $plugin_path . $template_name;
if ( ! $template )
$template = $_template;
return $template; }
Alles anzeigen