Drop Cap和P标签在描述上不受尊重

时间:2017-05-29 10:42:05

标签: php wordpress

我在主题下的tribe_events文件夹中的event_single.php中有这段代码。我一直试图做下降帽,但似乎这不起作用,甚至p标签也没有得到尊重。

<div id="post-<?php the_ID(); ?>" <?php post_class('event__main'); ?>>
    <?php while (have_posts()):  the_post(); ?>
        <div class="event__description page__content">
            <h3 class="event__description__title"><?php _e('Description') ?></h3>
            <?php do_action('tribe_events_single_event_before_the_content') ?>
            <?php
                $content = apply_filters('the_content', get_the_content());
                echo preg_replace('/<p>(.)/', '<p><span class="drop-cap">$1</span>', $content, 1);
            ?>
            <?php do_action('tribe_events_single_event_after_the_content') ?>
        </div>

        <div class="event__details">
            <?php do_action('tribe_events_single_event_before_the_meta') ?>
            <?php tribe_get_template_part('modules/meta'); ?>
            <?php do_action('tribe_events_single_event_after_the_meta') ?>
        </div>
    <?php endwhile; ?>
</div>

0 个答案:

没有答案