0

我有一个 wordpress 网站,我需要在每个标题的末尾添加一张图片。问题是这些是小部件,所有文本都被 wordpress 中的小部件替换。有没有办法可以将图像硬编码到标题的末尾,这样它就不会被删除?

<div class="grid_4 widget">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 1') ) : ?>
<h2 class="beeh2">Widgetized Area 1</h2>
<p>Go to Appearance - Widgets section to overwrite this section. Use any widgets that fits you best. This is called <strong>Bottom Left</strong>.</p>
<?php endif; ?> 
<div class="clear"></div>
</div>

<div class="grid_4 widget">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 2') ) : ?>
<h2 class="beeh2">Widgetized Area 2</h2>
<p>Go to Appearance - Widgets section to overwrite this section. Use any widgets that fits you best. This is called <strong>Bottom Middle</strong>.</p>
<?php endif; ?> 
<div class="clear"></div>

我还注意到,当我查看网站时,我创建的 h2 类也不存在。这似乎也被覆盖了。

4

1 回答 1

0

Inside of your functions.php (or file included there) you should see "register_sidebar". Footer 1 and Footer 2 are custom sidebars and are probably overwriting the code you are placing in the widget. Look for something like the code below.

register_sidebar( array(
    'name'          => 'Footer 1',
    'id'            => 'footer-1',
    'before_widget' => '',
    'after_widget'  => '',
    'before_title'  => '',
    'after_title'   => '',
) );

The 'before_title' and 'after_title probably contain your h2. Using html you can add your image in the 'after_title'.

Hope that helps!

于 2013-02-14T05:19:51.617 回答