С моим заголовочным файлом у меня есть следующий код ниже. Однако, если я отключаю плагин Woocommerce, я получаю много кодов ошибок (см. Ниже)
<ul class="site-header-cart menu">
<li>
<?php storefront_cart_link(); ?>
</li>
<li>
<?php the_widget( 'WC_Widget_Cart', 'title=' ); ?>
</li>
</ul>
/////////////////
это как-то связано с этой строкой - должно ли это быть оператором if. Я пытался исправить в течение нескольких часов, но безуспешно. Я только начинающий php гид с базовым пониманием
Когда «woocommerce» включен, страница выглядит нормально, без ошибок, однако некоторые ошибки jquery очевидны в хроме консоли - следовательно, попытка исправить код ошибки
https://tiltrak.com/webdev/
Неустранимая ошибка: необработанная ошибка: вызов неопределенной функции storefront_cart_link () в /home/mpex/tiltrak.com/public/webdev/wp-content/themes/storefront-child/header.php:43 трассировки стека: # 0 /home/mpex/tiltrak.com/public/webdev/wp-includes/template.php(688): require_once () # 1 /home/mpex/tiltrak.com/public/webdev/wp-includes/template.php ( 647): load_template ('/ home / mpex / tilt ...', true) # 2 /home/mpex/tiltrak.com/public/webdev/wp-includes/general-template.php(41): locate_template (Array правда) # 3 /home/mpex/tiltrak.com/public/webdev/wp-content/themes/storefront-child/page.php(5): get_header () # 4 /home/mpex/tiltrak.com/public /webdev/wp-includes/template-loader.php(74): include ('/ home / mpex / tilt ...') # 5 /home/mpex/tiltrak.com/public/webdev/wp-blog-header .php (19): require_once ('/ home / mpex / tilt ...') # 6 /home/mpex/tiltrak.com/public/webdev/index.php(17): require ('/ home / mpex / tilt ... ') # 7 {main} добавлено в /home/mpex/tiltrak.com/public/webdev/wp-content/themes/storefront-child/header.php в строке 43 * 1 013 *
Любая помощь с благодарностью
<?php
/**
* The header for our theme.
*
* Displays all of the <head> section and everything up till <div id="content">
*
* @package storefront
*/
?><!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2.0">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<style>
@import url('https://fonts.googleapis.com/css?family=Montserrat');
</style>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<!-- Start of Top Navigation -->
<div class="container-fluid grey-nav-bar">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-5 col-lg-5">
<?php wp_nav_menu( array( 'theme_location' => 'customer-menu' ) ); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-5 col-lg-5">
<?php wp_nav_menu( array( 'theme_location' => 'place-adverts' ) ); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-2 col-lg-2">
<ul class="site-header-cart menu">
<li>
<?php storefront_cart_link(); ?>
</li>
<li>
<?php the_widget( 'WC_Widget_Cart', 'title=' ); ?>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- End of Top Navigation -->
<!-- Start of Top Logo and Product Search -->
<div class="container-fluid">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="main-logo"><a href="https://tiltrak.com/webdev/home"><img src="https://tiltrak.com/webdev/wp-content/uploads/2018/11/tiltrak-automotive-marketplace-buy-sell-cars-classic-cars-motorcycles-vans-commercial-vehicles-autojumble-motor-factors-accessories-shop-uk.jpg" alt="tiltrak automotive marketplace buy sell cars classic cars motorcycles vans commercial vehicles autojumble motor factors accessories shop uk"></a> </div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="search-tophold">
<div class="site-search">
<?php if ( function_exists( 'aws_get_search_form' ) ) { aws_get_search_form(); } ?>
</div>
<div class="contact-header">Tel: <a href="tel:01925394434">01925 394 434</a> • Email: <a href="mailto:hello@tiltraks.com">hello@tiltrak.com</a></div>
</div>
</div>
</div>
</div>
</div>
<!-- End of Top Logo and Product Search -->
<?php do_action( 'storefront_before_site' ); ?>
<?php do_action( 'storefront_before_header' ); ?>
<header id="masthead" class="site-header" role="banner" style="<?php storefront_header_styles(); ?>">
<?php
/**
* Functions hooked into storefront_header action
*
* @hooked storefront_header_container - 0
* @hooked storefront_skip_links - 5
* @hooked storefront_social_icons - 10
* @hooked storefront_site_branding - 20
* @hooked storefront_secondary_navigation - 30
* @hooked storefront_product_search - 40
* @hooked storefront_header_container_close - 41
* @hooked storefront_primary_navigation_wrapper - 42
* @hooked storefront_primary_navigation - 50
* @hooked storefront_header_cart - 60
* @hooked storefront_primary_navigation_wrapper_close - 68
*/
do_action( 'storefront_header' ); ?>
</header><!-- #masthead -->
<?php
/**
* Functions hooked in to storefront_before_content
*
* @hooked storefront_header_widget_region - 10
* @hooked woocommerce_breadcrumb - 10
*/
do_action( 'storefront_before_content' ); ?>
<div id="content" class="site-content" tabindex="-1">
<div class="col-full">
<?php
do_action( 'storefront_content_top' );