首页 > 解决方案 > 如何修复警告:非法字符串偏移“描述”

问题描述

在对 WP 进行了一些更新后,我的旧主题在 single-service.php 中损坏了警告:第 40、44、48 行的非法字符串偏移 'description'、programm'、'duration' .../wp-content/themes/haircut/single -service.php

                       <!-- CONTENT -->
                        <section class="xx_content">

                            <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
                            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

                                <div class="service_description desc">
                                    <h3>Курс "<?php the_title(); ?>"</h3>
                                    <?php if ($service_fields['description'] != '') {
                                        echo $service_fields['description'];
                                    } ?>
                                    <?php if ($service_fields['programm'] != '') { ?>
                                        <h5>Програма курсу</h5>
                                        <?php echo $service_fields['programm']; ?>
                                    <?php } ?>
                                    <?php if ($service_fields['duration'] != '') { ?>
                                        <h5>Тривалість</h5>
                                        <?php echo $service_fields['duration']; ?>
                                    <?php } ?>
                                </div>

                            </article>
                            <?php endwhile; endif; wp_reset_query();?>


                        </section>
                        <!-- /CONTENT -->

标签: phpwordpress

解决方案


推荐阅读