Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Schema.org菜单类型属性hasMenuAction&;哈斯梅纽特姆_Html_Schema.org - Fatal编程技术网

Html Schema.org菜单类型属性hasMenuAction&;哈斯梅纽特姆

Html Schema.org菜单类型属性hasMenuAction&;哈斯梅纽特姆,html,schema.org,Html,Schema.org,我正试图在schema.org中创建一个菜单,但不知怎么的,它是无效的。这与属性HasMenuAction和hasMenuItem有关。我在这个代码中做错了什么 <div itemscope itemtype="http://schema.org/Menu" itemref="restaurant-info-footer"> <meta itemprop="url" content="<?php the

我正试图在schema.org中创建一个菜单,但不知怎么的,它是无效的。这与属性HasMenuAction和hasMenuItem有关。我在这个代码中做错了什么

<div itemscope itemtype="http://schema.org/Menu" itemref="restaurant-info-footer">
<meta itemprop="url" content="<?php the_permalink(); ?>">
<meta itemprop="mainEntityOfPage" content="<?php the_permalink(); ?>">
<meta itemprop="inLanguage" content="<?php echo get_locale(); ?>">
<h2 itemprop="name"><?php echo get_the_title( $menu_id ); ?></h2>

<?php if ( ! empty( $menu_price ) && ! is_null( $menu_price ) && $hide_prices ) : ?>
    <span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
        <meta itemprop="price" content="<?php echo number_format( $menu_price, 2, ',', '.'); ?>">
        <meta itemprop="priceCurrency" content="EUR">
    </span>
<?php endif; ?>

<div class="courses" itemscope itemprop="hasMenuSection" itemtype="http://schema.org/hasMenuSection">
    <?php foreach ( $courses as $course ) : ?>
        <div class="course" itemscope itemprop="MenuSection" itemtype="http://schema.org/MenuSection">
            <div class="course-holder" style="background-image: url(<?php echo $course['image']; ?>);">
                <h3 itemprop="name"><?php echo $course['name']; ?></h3>
            </div>
            <div class="course-dishes" itemscope itemprop="hasMenuItem" itemtype="http://schema.org/hasMenuItem">
                <?php foreach ( $course['dishes'] as $dish ) : ?>
                    <?php $dish = $dish['dish']; ?>
                    <div class="dish" itemscope itemprop="MenuItem" itemtype="http://schema.org/MenuItem">
                        <h4 itemprop="name"><?php echo get_the_title( $dish ); ?></h4>
                        <?php if ( ! empty( get_field( 'more-price', $dish ) ) && ! is_null( get_field( 'more-price', $dish ) ) && ! $hide_prices ) : ?>
                            <span class="more-price">(<?php _e( 'addition', 'croy-plugin' ); ?> <?php the_field( 'more-price', $dish ); ?>)</span>
                        <?php endif; ?>
                        <?php if ( get_field( 'vegan', $dish ) ) : ?>
                            <span class="vegan" itemprop="suitableForDiet" content="http://schema.org/VeganDiet"></span>
                        <?php endif; ?>
                        <p itemprop="description"><?php the_field( 'subtitel', $dish ); ?></p>
                        <?php if ( ! empty( get_field( 'price', $dish ) ) && ! is_null( get_field( 'price', $dish ) ) && ! $hide_prices ) : ?>
                            <div class="price" itemprop="offers" itemtype="http://schema.org/offers" itemscope>
                                <p itemprop="price"><?php echo number_format( get_field( 'price', $dish ), 2, ',', '.' ); ?></p>
                                <meta itemprop="priceCurrency" content="EUR">
                            </div>
                        <?php endif; ?>
                    </div>
                <?php endforeach; ?>
            </div>
        </div>
    <?php endforeach; ?>
</div>

( )

调试器会显示以下错误:

hasMenuSection不是属性hasMenuSection的有效目标类型

hasMenuItem不是属性hasMenuItem的有效目标类型

虽然优惠和菜单都很好

有什么建议吗?

是属性,而不是类型。因此,下面的代码两次设置itemscope,一次为HasMenuAction(不是类型)设置,一次为MenuAction(不是属性)设置,是不正确的


代码应如下所示
itemscope
用于声明一个新范围
itemprop
引用属性名称
itemtype
是指包含在中的类型


这同样适用于


应该是


随后的相关错误是由类似错误引起的


优惠不是一种类型,而是一种属性
itemprop=“offers”
在声明属性时是正确的,但itemtype应该是正确的,而不是不存在的offers。上述操作将导致以下错误:

offers不是offers属性的已知有效目标类型

所以应该是


是属性,而不是类型。因此,下面的代码两次设置itemscope,一次为HasMenuAction(不是类型)设置,一次为MenuAction(不是属性)设置,是不正确的


代码应如下所示
itemscope
用于声明一个新范围
itemprop
引用属性名称
itemtype
是指包含在中的类型


这同样适用于


应该是


随后的相关错误是由类似错误引起的


优惠不是一种类型,而是一种属性
itemprop=“offers”
在声明属性时是正确的,但itemtype应该是正确的,而不是不存在的offers。上述操作将导致以下错误:

offers不是offers属性的已知有效目标类型

所以应该是