我使用以下PHP代码注册侧栏:
register_sidebar(array(
'name' => 'Owner\'s main page intro left sidebar.',
'id' => 'main-left-sidebar',
'description' => 'This is the main side bar of the theme i.e. the information of the author on the index page will be displayed using it. Note: It MUST have a single text widget or otherwise it may distort the theme',
'before_widget' => '',
'after_widget' => '</p>',
'before_title' => '<div class="porse"><h3 id="titlehead">',
'after_title' => '</h3></div><p class="porse-lead">'
));
因此,当我添加一个小部件(我正在使用文本小部件)时,它会生成如下内容:
<div class="porse">
<h3 id="titlehead">I'm Kamran Ahmed</h3>
</div>
<p class="porse-lead">I make websites. I help small businesses, start-ups, individuals, and fellow web agencies make the most of their web presence.</p>
但是每当我将小部件添加到侧边栏时,它都会产生以下标记:
<div class="porse">
<h3 id="titlehead">I am Kamran Ahmed</h3>
</div>
<p class="porse-lead"> </p>
<div class="textwidget">I make websites. I help small businesses, start-ups, individuals, and fellow web agencies make the most of their web presence.</div>
<p></p>
任何人都可以告诉我,我在这里做错了什么。为什么不生成我想要的标记?
答案 0 :(得分:0)
您无法在<div>
标记内使用<p>
标记。
请改为尝试:
register_sidebar(array(
'name' => 'Owner\'s main page intro left sidebar.',
'id' => 'main-left-sidebar',
'description' => 'This is the main side bar of the theme i.e. the information of the author on the index page will be displayed using it. Note: It MUST have a single text widget or otherwise it may distort the theme',
'before_widget' => '',
'after_widget' => '</div>',
'before_title' => '<div class="porse"><h3 id="titlehead">',
'after_title' => '</h3></div><div class="porse-lead">'
));