SIG的无花果首页SIG的无花果新闻SIG的无花果通过电子邮件SIG的无花果最热门的职位
重要人物
Helping you, by helping myself with blogging, browsing, and tech tips 帮助您,帮助自己与博客,浏览和高新技术的秘诀

Widgetizing Your Blog widgetizing您的博客

June 15th, 2007 · by David Bradley 2007年6月15日,大卫布拉德利

If you have already upgraded to Wordpress 2.2, then this post is not for you.如果您已升级到2.2的WordPress ,那么这个职位是不是你。 But, if you are languishing on an earlier installation and running a theme that does not support widgets, then you may like to check out how to get widgetized.但是,如果您是languishing对先前安装和运行的一个主题,这并不支持widgets的,那么您可能想检查如何获得widgetized 。 But, first what are widgets?但是,首先是什么工具? Well, they’re little snippets of code that sit in their own boxes within your sidebar and can be reordered with a simple drag and drop.那么,他们正在小片断的代码,静坐在自己的箱子在您的工具栏可以重新排序,与一个简单的拖放。 So, your search box is at the bottom and your Feedburner count at the top but you want them the other way around?所以,您的搜索框是在底部和您的feedburner计数在最上方,但你希望他们其他方式? It’sa lot of cutting and pasting with the standard sidebar in Theme Editor, but if your blog is widgetized all you do is drag the search widget to the top of the stack and the Feedburner block to the bottom.这是大量的切割和粘贴符合标准工具栏在主题编辑器,但如果您的博客是widgetized所有你做的是拖曳搜索窗口组件上方的堆栈和feedburner座至底部。 And save the new settings.并保存新的设置。

The Automattic site has the full skinny on该automattic网站已充分瘦就 widgetizing your site widgetizing您的网站 and provides you with the necessary downloads, so I am not going to repeat their wise words here.为您提供必要的下载,所以我不再重复他们的明智的话在这里。 But, one aspect of widgetizing the Sciencebase site earlier this year, prior to the release of version 2.2, was that I simply could not eradicate an orphaned bullet point that was appearing at the top of the sidebar with no entry to which is was associated.但是,一个方面widgetizing该sciencebase网站今年早些时候,该标准发布以前, 2.2版,是我根本无法根除孤立的子弹点,这是出现在工具栏顶部没有进入这是相关。 I messed around with the li and ul tags in the widgets themselves, played with the css in the widgets.php (adding the list-style-type: none; tag to all and sundry to try and delete the little dot). i搞砸左右,与李和UL标签,在widgets的自己,发挥与CSS中,在widgets.php (加入名单式类型:无;标记所有和杂项尝试,并删除小点) 。 Actually, I grew quite fond of the little critter in the end, but knew that most visitors would prefer not to see the bullet, it was far too distracting.其实,我增长了不少喜欢的小critter在年底,但知道大部分的旅客会不希望看到的子弹,这是过于分散。

Finally, after searching the web and reading the manual a dozen times or more I went back to the Automattic site, where it finally dawned on me that a hack they mentioned in regard to formating non-standard sidebars ready to be widgetized might actually work for me too.最后,在网路搜寻和阅读手册的十多倍或更多的我回到了automattic网站,在那里最后的曙光对我说,哈克,他们中提到的关于formating非标准提要栏随时可以widgetized实际上可能会工作我也是。

To make widgets work in versions of Wordpress pre-2.2 you have to have a file called functions.php in your theme’s folder.使构件的工作版本WordPress的前2.2你必须有一个名为functions.php在您的主题的文件夹。 This file holds nothing but a conditional tag to render the widgetized sidebar as appropriate, but you can add an extra argument or two to make the widget plugin ignore some of the formating in its inbuilt CSS:这个档案举行只不过是一个有条件的标记,使widgetized栏适当的,但您可以添加额外的论点或二,使该Widget插件忽略一些对formating在其内在的CSS :

<?php < ? PHP的
if ( function_exists(’register_sidebar’) )如果( function_exists ( ' register_sidebar ' ) )
register_sidebar(array( register_sidebar (阵列(
‘before_widget’ => ”, // Removes the list tag ' before_widget ' = > “ , / /删除清单标记
‘after_widget’ => ”, // Removes removes the end list entry tag ' after_widget ' = > “ , / /删除删除年底列表项标记
‘before_title’ => ”, // Removes the head tag ' before_title ' = > “ , / /删除头部标记
‘after_title’ => ”, // Removes the end head tag ' after_title ' = > “ , / /删除年底头部标记
)); ) ) ;
?> ? >

Once I’d added this code, fixing the angle brackets to be the actual html enclosures, and reloaded the Sciencebase site up it popped, sans bullet.有一次我要加入这个代码,固定的角度来看,括号内要实际的HTML罩,重新载入该sciencebase网站,它出现, SAN的子弹。 I will miss the little critter though.我会怀念小critter虽然。

2 responses so far ↓ 2反应到目前为止↓

  • Eliena // eliena / / Jun 17, 2007 at 2:35 pm 2007年6月17日在下午2时35分

    can i implement this code on my blog page ?我可以执行此代码对我的博客网页?

  • David Bradley 大卫布拉德利 // / / Jun 17, 2007 at 7:02 pm 2007年6月17日在下午7点02分

    Sorry Eliena, but I don’t understand why you would want to do that in the first place. eliena抱歉,但我不明白你为什么想这样做,摆在首位。 Blogspot is its own system, presumably you have not above blog folders anyway, so what would you be implementing, regardless of the fact the hack is for Wordpress? BlogSpot的是自己的系统,假定你有没有上述的博客文件夹无论如何,所以你会怎样实施,无论其事实上,哈克是在WordPress ?

    db分贝

Leave a Comment留下意见

Comments are checked for spam before appearing, no need to post it twice.评论是检查垃圾邮件之前出现,不需要后两次。

Related Posts相关文章