如何在此回显输出中添加H1标签? [英] How do i add an H1 tag to this echo output?

查看:70
本文介绍了如何在此回显输出中添加H1标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将 h1 标记添加到此回显的输出时遇到问题。回声在我的Wordpress安装中是一个较大函数的内部。

I am having trouble adding an h1 tag to to the output of this echo. The echo is inside a larger function in my Wordpress install.

该代码是较大函数的一部分。我试图将echo语句用单引号和双引号括在 h1 标记中。我还尝试将回声分隔到另一个PHP包装器中。

The code is part of a larger function. I've tried to enclose the echo statement in h1 tag with single quotes and double quotes. I've also tried to separate the echo inside another PHP wrapper.

<?php if ( is_tax( 'wap8-portfolio-tags' ) ) { // adds tag name to title block
        $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var('taxonomy'));
        echo $term->name;
    }

我想看到回显输出的变量是 h1 样式。

I'd like to see the echo output the variable with h1 styling.

推荐答案

这应该可行

echo '<h1>' . $term->name . '</h1>'; 

这篇关于如何在此回显输出中添加H1标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆