Advanced Custom Field
-
I made a new tab with ACF and implemented it in my themes function.php and it works perfectly as it should. But I need another tap too, and when I implement it in the same way as the first, I get the following error:
Fatal error: Can not ready clare nova_wp_product_tabs () (previously Declared in /var/www/www.wannafinddemo5.dk/www/wp-content/themes/nova-wp/functions.php:15) in /var/www/www.wannafinddemo5 .com / www / wp-content / themes / nova-wp / functions.php on line 61
How do I fix that problem?
Here is how I implemented both taps in my themes function.php<?php
/**
* Nova WP engine room
*
* @package nova-wp
*//**
* Initialize all the things.
*/require get_stylesheet_directory() . ‘/inc/init.php’;
add_filter( ‘woocommerce_product_tabs’, ‘nova_wp_product_tabs’ );function nova_wp_product_tabs( $tabs ) {
// ensure ACF is available
if ( !function_exists( ‘get_field’ ) )
return;$content = trim( get_field( ‘levering’ ) );
if ( !empty( $content ) ) {
$tabs[] = array(
‘title’ => ‘Levering’,
‘priority’ => 15,
‘callback’ => ‘nova_wp_levering’
);}
return $tabs;
}function nova_wp_levering() {
echo get_field( ‘levering’ );
}
require get_stylesheet_directory() . ‘/inc/init.php’;
add_filter( ‘woocommerce_product_tabs’, ‘nova_wp_product_tabs’ );function nova_wp_product_tabs( $tabs ) {
// ensure ACF is available
if ( !function_exists( ‘get_field’ ) )
return;$content = trim( get_field( ‘plantning_og_pasning’ ) );
if ( !empty( $content ) ) {
$tabs[] = array(
‘title’ => ‘Plantning og pasning’,
‘priority’ => 15,
‘callback’ => ‘nova_wp_plantning_og_pasning’
);}
return $tabs;
}function nova_wp_plantning_og_pasning() {
echo get_field( ‘plantning_og_pasning’ );
}what is wrong making two taps in that way?
- The topic ‘Advanced Custom Field’ is closed to new replies.