在Wordpress侧边栏中显示Unicode字符


Display Unicode character in Wordpress sidebar

我已经用一些Unicode字符创建了一个自定义侧边栏,但在查看Unicode字符时遇到了问题。这是我的侧边栏代码:

<?php
/**
* The Sidebar containing the main widget areas.
*
* @package Theme Meme
*/
?>
<div class="col-md-4 site-sidebar" role="complementary">
<?php do_action( 'before_sidebar' ); ?>
<?php if ( ! dynamic_sidebar( 'post_group_sidebar' ) ) : ?>
    <h3 class="widget-title">Title in Unicodé</h3> </br>
<?php endif; ?>
</div>

我不知道如何让它工作,也许我必须添加一个元标记来显示Unicode?

非常感谢您的帮助

好的,所以我在想边栏是否显示了数据库中的任何内容?您可以随时将数据库合并更改为utf8_general_ci

以下是如何做到

1) 打开并编辑Wordpress网站根目录中的wp-config.php文件,并将默认的DB_CHARSETDB_COLLATE行替换为:

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', 'utf8_general_ci' );

把它存回去看看是否有效。

否则,您也可以在PHP或HTML代码中包含下面的一行。

在您的PHP代码中,将以下内容放在PHP代码的顶部:

header('Content-type: text/html; charset=UTF-8');

在HTML中,在<head></head>标签之间或标签上方添加以下行:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

祝你好运!