冰古blog » wordpress » 2005 » 04 » 02 » 在新窗口打开链接

在新窗口打开链接

每次写blog时总要在加上链接的时候自己写上target="_blank",而使链接在新窗口打开呢?
这里有个方法,可以解决:Open Links in New Window, WP Tutorial

1. Global Change for links to open new window
File: index.php
Find: <head> tag
Add: <base target="_blank">

2. Article Titles
File: index.php
Find: <a> tag with “storytitle” class
Add: target="_self" inside </a><a> tag

3. Category Links
File: /wp-includes/template-functions-category.php
Find: function the_category
Add in 3 spots: target="_self" inside </a><a> tags

4. Comments Link
File: /wp-includes/template-functions-comment.php
Find: function comments_popup_link
Add: target="_self" inside </a><a> tag

5. Calendar (sidebar)
File: /wp-includes/template-functions-general.php
Find: function get_calendar
Add in 3 spots: target= inside </a><a> tags

6. Category Links (sidebar)
File: /wp-includes/template-functions-category.php
Find: function list_cats
Add: target="_self" inside </a><a> tag (near bottom inside Foreach loop)

7. Archive Links (sidebar)
File: /wp-includes/template-functions-general.php
Find: function get_archives_link
Add in 2 spots: target="_self" inside </a><a> tags

8. Search Form (sidebar)
File: index.php
Find: <form> tag
Add: target="_self" inside </form><form> tag

9. Misc. Links (sidebar) i.e. About Me
File: /index.php
Find: any instances
Add: target=”_self” inside <a> tags

10. Comments Form submit
File: /wp-comments.php
Find: <form> tag
Add: add target="_self" attribute</form></a></form></a></base></head></blockquote>

3 Responses to “在新窗口打开链接”

  1. 型男索女 says:

    这个非常实用,谢谢!

  2. […] 前两天才介绍了一个“在新窗口打开链接”的hack,现在又有人做了一个插件来达到同样的效果!external links in new windows 这个插件使用javascript,在后台激活插件后,要在template中加上下面这行代码: <?php showexternabox(); ?> […]

  3. […] 2005 on 12:58 am | In 本站原创, WordPress

    前两天才介绍了一个“在新窗口打开链接”的hack,现在又有人做了一个插件来达到同样的效果!exte […]

Leave a Reply