年年我发 立即注册PayPal并开始接受信用卡付款。
http://www.paypal.com



返回   年年我发 > 网站建设 > Blog(博客)/Wiki(维客)/RSS/Cms
用户名
密码
 
注册账号 论坛帮助 会员列表 日历事件网赚工具 标记版面已读

Blog(博客)/Wiki(维客)/RSS/Cms Blog(博客)/、Wiki(维客)、RSS、Cms等WEB 2.0相关技术讨论专区。




回复
 
主题工具 搜索本主题 显示模式
  #1   IP: 59.60.147.228
旧 2007-10-16, 08:25 PM
car car 当前离线
高级会员
 
注册日期: 2006-05-14
帖子: 420
精华: 0
现金: 4417 元
资产: 4417 元
声望: 10 car 正向着好的方向发展
默认 How to widgetise Grid Focus wordpress theme

It’s very simple and you can probably do it in 5 minutes. Remember before you start, to backup all the files you will require to modify - I will not be held responsible if it does work. This has been tested on my web site running wordpress version 2.2.

Ok, let’s get started.

Step 1:
The first thing you need to do is to create a file called ‘functions.php’ in which you have add the following code. This is a file that Wordpress looks for and reads it if it finds it:


代码:
<?php if ( function_exists('register_sidebar') ) register_sidebars((2),array( 'before_widget' => '<div class="sidebar_widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>', )); ?>

Once you have done that, save your file and upload it in the same folder that holds your theme.

Step 2:
In this step you will need to modify the file originally provided with the theme called ’second.php’. This step really is up to you as it depends on much of the original structure you want to keep. For example you might want to keep the link sections and add widgets, you might want to keep the meta section and add widgets - it’s up to you. In my case, I have kept the search form and added widget capability.

The original code of the file ’second.php’ was:


<div id="midCol">
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<div class="middle_links">
<h3>Your choice links</h3>
<p>Your choice links. Let readers know what they should be reading on your site.</p>
<ul>
<li><a href="#">Link Title</a> - Link description (optional)</li>
<li><a href="#">Link Title</a> - Link description (optional)</li>
<li><a href="#">Link Title</a> - Link description (optional)</li>
<li><a href="#">Link Title</a> - Link description (optional)</li>
<li><a href="#">Link Title</a> - Link description (optional)</li>
</ul>
</div>
<div class="middle_links">
<h3>Your choice links</h3>
<p>Your choice links. Let readers know what they should be reading on your site.</p>
<ul>
<li><a href="#">Link Title</a> - Link description (optional)</li>
<li><a href="#">Link Title</a> - Link description (optional)</li>
<li><a href="#">Link Title</a> - Link description (optional)</li>
<li><a href="#">Link Title</a> - Link description (optional)</li>
<li><a href="#">Link Title</a> - Link description (optional)</li>
</ul>
</div>
<div class="middle_links">
<h3>Subscribe</h3>
<p>Stay updated on my meandering thoughts &amp; activities via RSS (Syndicate).</p>
<ul>
<li><a href="feed:<?php bloginfo('rss2_url'); ?>" title="Full content RSS feed">Content RSS</a> - Straight to your reader</li>
<li><a href="feed:<?php bloginfo('comments_rss2_url'); ?>" title="Full comments RSS feed">Comments RSS</a> - Add to the discussion</li>
</ul>
</div>
<div class="middle_links">
<h3>Meta</h3>
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<?php wp_meta(); ?>
</ul>
</div>
</div>
After my changes, my file now looks like:


<div id="midCol">
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) : ?>
<?php endif; ?>
</div>
Step 3:
In this step you will need to modify the file originally provided with the theme called ‘third.php’. Again, this depends on you - on how much of the original file you want to keep. In my case, I have kept the original file structure (i.e the option to add picture links) and simply added widget capability before the links.

The original code of the file ‘third.php’ was:


<div id="tertCol">
<div id="elseWhere">
<h3>Before you go</h3>
<p>Going so soon? May these links be a guide to web enlightenment. Schwing!</p>
<ul id="imgLinks">
<li><a href="http://5thirtyone.com/grid-focus" title="Download Grid Focus by: Derek Punsalan"><img src="<?php bloginfo('template_directory'); ?>/images/guide/grid_focus_531.gif" alt="Grid Focus - 531" /></a></li>
<li><a href="http://is.derekpunsalan.com/" title="Visit Derek Punsalan...is"><img src="<?php bloginfo('template_directory'); ?>/images/guide/is.gif" alt="Derek Punsalan...is" /></a></li>
</ul>
</div><!-- close #imgLinks -->
</div><!-- close #tertCol -->
After my changes, my file now looks like:


<div id="tertCol">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(2) ) : ?>
<?php endif; ?>
<div id="elseWhere">
<h3>Before you go</h3>
<p>Going so soon? May these links be a guide to web enlightenment. Schwing!</p>
<ul id="imgLinks">
<li><a href="http://5thirtyone.com/grid-focus" title="Download Grid Focus by: Derek Punsalan"><img src="<?php bloginfo('template_directory'); ?>/images/guide/grid_focus_531.gif" alt="Grid Focus - 531" /></a></li>
<li><a href="http://is.derekpunsalan.com/" title="Visit Derek Punsalan...is"><img src="<?php bloginfo('template_directory'); ?>/images/guide/is.gif" alt="Derek Punsalan...is" /></a></li>
</ul>
</div><!-- close #imgLinks -->
</div><!-- close #tertCol -->
All you now have to do, is to go to the ‘Widgets’ section (under Presentation) in the admin part of your site and add the widgets you want.
回复时引用此帖

wellcome to www.0058.net
回复


当前查看此主题的会员: 1 (0 位会员和 1 位游客)
 
主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

论坛启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码
论坛跳转

相似的主题
主题 主题作者 版面 回复 最后发表
WordPress 中文包 sunshine Blog(博客)/Wiki(维客)/RSS/Cms 0 2007-03-12 10:16 AM


所有时间均为北京时间. 现在的时间是 11:40 PM, Free Patent & Patent Ideas


Powered by vBulletin 3.5.2 Chinese Exhibition Happy New Year
©2000 - 2008,Jelsoft Enterprises Ltd  Desiccant Molecular Sieve Weight Loss Bentonite Trade Manager