朱文昊 Albert Zhu

该用户没有分享资料

首页: http://zhuwenhao.com


朱文昊 Albert Zhu

修改主题支持两种菜单并存

在本站升级到Wordpress 3.0后,浏览了一下许久没有看过的themes目录,发现几个我喜欢的主题,经过一番试用,发现Mystique也就是您现在看到的主题最合我心意,后来才发现这也是digitalnature的作品,good job!

美中不足的是,Mystique配置界面中主菜单只能在无、链接、页面、分类目录和自定义菜单中做单选,我希望能把分类目录和自定义菜单并存,一起显示出来。可惜作者没有设计这样的功能。Hacking的真谛就是要自己动手,当然还有无私分享。下面我就贴出我的做法:

先来看看core.php中相关功能实现函数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// print the main navigation menu
function mystique_navigation() {
  $navtype = get_mystique_option('navigation');
  if($navtype): ?>
 
   <div class="shadow-left">
   <div class="shadow-right clearfix">
   <?php
    $nav_extra = apply_filters("mystique_navigation_extra", '');  // check for new icons and output
    if($nav_extra) echo '<p class="nav-extra">'.$nav_extra.'</p>';  ?>
 
   <ul id="navigation" class="clearfix">
     <?php
      if((get_option('show_on_front')<>'page') && get_mystique_option('exclude_home')<>'1'):
       if(is_home() && !is_paged()): ?>
        <li class="active home"><a class="home active fadeThis" href="<?php echo get_settings('home'); ?>" title="<?php _e('You are Home','mystique'); ?>"><span class="title"><?php _e('Home','mystique'); ?></span><span class="pointer"></span></a></li>
       <?php else: ?>
        <li class="home"><a class="home fadeThis" href="<?php echo get_option('home'); ?>" title="<?php _e('Click for Home','mystique'); ?>"><span class="title"><?php _e('Home','mystique'); ?></span><span class="pointer"></span></a></li>
      <?php
       endif;
      endif; ?>
     <?php
       if($navtype=='categories'):
        mystique_list_categories(array('hide_empty' => false, 'exclude' => get_mystique_option('exclude_categories')));
 
       elseif($navtype=='links'):
        $links = get_bookmarks(array(
        'orderby'        => 'name',
        'order'          => 'ASC',
        'limit'          => -1,
        'category'       => null,
        'category_name'  => get_mystique_option('navigation_links'),
        'hide_invisible' => true,
        'show_updated'   => 0,
        'include'        => null,
        'search'         => '.'));
 
        foreach ($links as $link):
         if($link->link_target) $target = ' target="'.wp_specialchars($link->link_target).'"'; else $target = '';
         if($link->link_rel) $rel = ' rel="'.wp_specialchars($link->link_rel).'"'; else $rel = '';
         if($link->link_description) $title = ' title="'.wp_specialchars($link->link_description).'"'; else $title = '';
         echo '<li><a class="fadeThis" href="'.$link->link_url.'"'.$target.$rel.$title.'><span class="title">'.$link->link_name.'</span><span class="pointer"></span></a><li>';
        endforeach;
 
       else:
        mystique_list_pages(array('exclude' => get_mystique_option('exclude_pages'), 'sort_column' => 'menu_order'));
       endif;
 
       do_action('mystique_navigation'); ?>
   </ul>
   </div>
   </div>
  <?php endif;
}

可以看出,作者整体设计的时候,就没有想要让用户做复选,在条件判断中使用了连续的if … elseif… 实现。

我采用了一个偷懒的方法仅把

1
if($navtype=='categories'):

注释掉,然后把接下来的

1
 elseif($navtype=='links'):

改成

1
 if($navtype=='links'):

就可以啦。

WordPress 3.0 升级会搞乱固定链接的格式

血的教训啊。Wordpress 升级到3.0版本的时候,一切似乎很正常,但是却悄悄的把永久链接的格式给搞乱了,我以前设定是用Post_id做为第一个参数,现在默认为/blog/,才过两天,出现一堆404错误,访问量骤降。赶紧把格式改回原来的。希望早日恢复正常。

为所有查找资料来我站,又遇到404错误的用户表示深深的歉意!

U3量产工具失败教训和修复过程

我的16G U3 Cruzer U盘,在使用量产工具Universal_Customizer之后,竟然变成4G总容量了。经过一番homework,原来是这个Universal_Customizer 1.0.0.8太老了,只支持小容量的U3,需要新版本的u3dapi10.dll。 狂搜,下载到u3dapi10.dll 1.0.9.0版本,替换Universal_Customizer中老版本的dll然后再次运行,还是4G回不来。

解决方法,利用原版工具 http://u3.sandisk.com/download/lp_installer.asp 重新初始化U3,容量就可以恢复到16G(15.3G)了。

然后运行自己制作的新版Universal_Customizer,就可以随心所欲制作自己的ISO文件了。

顺便鄙视一下很多论坛,下载文件要注册,注册还要邀请,拿邀请还要收费。唉,就这么点别人老外做的东西,还要藏着掖着,怪不得科技水平增速赶不上GDP呢。

我免费提供相关资源的下载,有需要的朋友狠狠的下载吧!

IEEE SEEKS SPONSORS FOR THE IEEExtreme 4.0 PROGRAMMING COMPETITION

IEEEXtreme is a global challenge in which teams of student members (supported by an IEEE Student Branch, advised and proctored by an IEEE Member) compete in a 24-hour time span against each other to solve a set of programming problems.
Last year with nearly 700 teams from over 40 countries, IEEEXtreme 3.0 broke records for participation. This year IEEEXtreme 4.0 will take place on Saturday 23 October, 2010. It is anticipated that participation will once again reach a record high.

With more than 95,000 student members at over 1,800 student branches in universities around the world, sponsorship of student competitions is an excellent way of improving your visibility with IEEE student members.

Sample problems from past competitions, rules, past winners and more are available at:
http://ieeestandards.org/ct.html?rtr=on&s=8nv,1dwtd,2xny,b91z,dnd1,gxzm,3xa8

For the benefits of sponsorship, sponsorship options, and sponsorship vehicles, please view:
http://ieeestandards.org/ct.html?rtr=on&s=8nv,1dwtd,2xny,4roc,g362,gxzm,3xa8

For more information or to become a sponsor:

Call +1 732 562-5392
Email goxtreme@ieee.org
*******

IEEE Standards Association
445 Hoes Lane
Piscataway, NJ 08854

IEEE会员买DELL电脑有折扣

肠子都悔青了, 前段时间给老婆买了一个DELL台式机, 今天才注意到IEEE会员有DELL的特殊优惠,可以拿到3%~5%的大客户优惠, 甚至还有10%的特殊机型优惠.

具体5000块以下的机型是优惠3%,5000块以上优惠5%,买外设优惠2%.哎,老婆那台台式机可以优惠350块呢.

还有其他一些优惠,比如HP,Mozy,FedEx等,IEEE会员朋友参考:

http://www.ieee.org/membership_services/membership/financial_advantage/home_office.html