douhaoqiao9304 2011-03-17 00:44
浏览 157

自定义wordpress主题中锚点的问题

Hi I've created a theme for wordpress www.litl.michalweb.pl. On the left side I have a sidebar with permalinks anchors. Each link has a form:

http://litl.michalweb.pl/upcoming2/#seven

and then in one of the posts I created an anchor like this

<a  id="seven">Event 7</a>

Im also using jscrollpane plugin and it looks like it doesn't work as it should. Here is how I'm using it: calling jquery:

<?php wp_enqueue_script( 'jquery' ); ?>

and placing the script:

$j(function()
{
        $j('.scroll-pane').jScrollPane(
        {
            hijackInternalLinks: true
        }
    );
 });

I don't know if it is important but here is the .htaccess file

 # BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] 
</IfModule>

# END WordPress

The weird thing is that my anchors works if I just place the code in the sidebar by:

<a href="http://litl.michalweb.pl/upcoming/#seven">All events7</a>

but it doesnt work if Im trying to use wordpress links. Here is most of my sidebar.php:

<div id="primary" class="widget-area" role="complementary"><ul class="xoxo">
<?php if ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>
    <?php wp_list_bookmarks( 'show_description=1&limit=4&between=<br />'); ?>

<?php endif; // end primary widget area ?>
        </ul><br><br><br>
<a href="http://litl.michalweb.pl/upcoming/#seven">All events7</a>
<a href="http://litl.michalweb.pl/upcoming/#three">All events3</a>

</div><!-- #primary .widget-area --> 

I think that the problem is caused by the fact that I've created this template from scratch using some online tutorials and probably there is one small bit that Im missing either in header.php, index.php or somewhere else. Unfortunately I cant make it work and jScrollPane doesn't behave like it should. I hope someone could point me to a solution to my problem. Thanks Michal

  • 写回答

1条回答 默认 最新

  • dsa5211314 2011-03-18 03:18
    关注

    What does the resultant HTML of your wp_list_bookmarks function look like? Also, does it work if you use a name attribute in addition to id (not valid HTML5, I know), OR use a heading / span element for the anchor?

    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大