html href链接显示,而不是标题php

时间:2018-10-17 15:39:48

标签: php wordpress woocommerce

出于某种原因,我的一个woocommerce网站上的相关产品已开始显示完整的HTML链接,而不是产品标题。

我将其范围缩小为主题的问题,因为在切换主题时标题可以正确显示。我还尝试过删除所有自定义CSS并停用所有插件。

这是我related.php的代码

    <?php

// Disable direct call
if ( ! defined( 'ABSPATH' ) ) { exit; }


/* Theme setup section
-------------------------------------------------------------------- */

if ( !function_exists( 'kingler_theme_template_related_theme_setup' ) ) {
    add_action( 'kingler_theme_action_before_init_theme', 'kingler_theme_template_related_theme_setup', 1 );
    function kingler_theme_template_related_theme_setup() {
        kingler_theme_add_template(array(
            'layout' => 'related',
            'mode'   => 'blog',
            'need_columns' => true,
            'need_terms' => true,
            'title'  => esc_html__('Related posts /no columns/', 'kingler-theme'),
            'thumb_title'  => esc_html__('Medium square image (crop)', 'kingler-theme'),
            'w'      => 370,
            'h'      => 370
        ));
        kingler_theme_add_template(array(
            'layout' => 'related_2',
            'template' => 'related',
            'mode'   => 'blog',
            'need_columns' => true,
            'need_terms' => true,
            'title'  => esc_html__('Related posts /2 columns/', 'kingler-theme'),
            'thumb_title'  => esc_html__('Medium square image (crop)', 'kingler-theme'),
            'w'      => 370,
            'h'      => 370
        ));
        kingler_theme_add_template(array(
            'layout' => 'related_3',
            'template' => 'related',
            'mode'   => 'blog',
            'need_columns' => true,
            'need_terms' => true,
            'title'  => esc_html__('Related posts /3 columns/', 'kingler-theme'),
            'thumb_title'  => esc_html__('Medium square image (crop)', 'kingler-theme'),
            'w'      => 370,
            'h'      => 370
        ));
        kingler_theme_add_template(array(
            'layout' => 'related_4',
            'template' => 'related',
            'mode'   => 'blog',
            'need_columns' => true,
            'need_terms' => true,
            'title'  => esc_html__('Related posts /4 columns/', 'kingler-theme'),
            'thumb_title'  => esc_html__('Medium square image (crop)', 'kingler-theme'),
            'w'      => 370,
            'h'      => 370
        ));
    }
}

// Template output
if ( !function_exists( 'kingler_theme_template_related_output' ) ) {
    function kingler_theme_template_related_output($post_options, $post_data) {
        $show_title = true; //!in_array($post_data['post_format'], array('aside', 'chat', 'status', 'link', 'quote'));
        $parts = explode('_', $post_options['layout']);
        $style = $parts[0];
        $columns = max(1, min(12, empty($post_options['columns_count']) 
                                    ? (empty($parts[1]) ? 1 : (int) $parts[1])
                                    : $post_options['columns_count']
                                    ));
        $tag = kingler_theme_in_shortcode_blogger(true) ? 'div' : 'article';

        if ($columns > 1) {
            ?><div class="<?php echo 'column-1_'.esc_attr($columns); ?> column_padding_bottom"><?php
        }
        ?>
        <<?php kingler_theme_show_layout($tag); ?> class="post_item post_item_<?php echo esc_attr($style); ?> post_item_<?php echo esc_attr($post_options['number']); ?>">

            <div class="post_content">
                <?php if ($post_data['post_video'] || $post_data['post_thumb'] || $post_data['post_gallery']) { ?>
                <div class="post_featured">
                    <?php
                    kingler_theme_template_set_args('post-featured', array(
                        'post_options' => $post_options,
                        'post_data' => $post_data
                    ));
                    get_template_part(kingler_theme_get_file_slug('templates/_parts/post-featured.php'));
                    ?>
                </div>
                <?php } ?>

                <?php if ($show_title) { ?>
                    <div class="post_content_wrap">
                        <?php
                        if (!isset($post_options['links']) || $post_options['links']) { 
                            ?><h5 class="post_title"><a href="<?php echo esc_url($post_data['post_link']); ?>"><?php kingler_theme_show_layout($post_data['post_title']); ?></a></h5><?php
                        } else {
                            ?><h5 class="post_title"><?php kingler_theme_show_layout($post_data['post_title']); ?></h5><?php
                        }
                        //kingler_theme_show_layout($reviews_summary);
                        if (!empty($post_data['post_terms'][$post_data['post_taxonomy_tags']]->terms_links)) {
                            ?><div class="post_info post_info_tags"><?php echo join(', ', $post_data['post_terms'][$post_data['post_taxonomy_tags']]->terms_links); ?></div><?php
                        }
                        ?>
                    </div>
                <?php } ?>
            </div>  <!-- /.post_content -->
        </<?php kingler_theme_show_layout($tag); ?>>    <!-- /.post_item -->
        <?php
        if ($columns > 1) {
            ?></div><?php
        }
    }
}
?>

如果需要,还可以链接到实时示例http://www.omni-techinfo.com/index.php/product/ad-blue-grundfos-pump/

1 个答案:

答案 0 :(得分:0)

如果您在HTML页面上查看源代码,则将在href之前的锚定标记中看到一个span标记。

outlined copy of Account?

可能会在文件 templates / _parts / post-featured.php 中找到违规行 或者可能在$ post_data本身内。