Huge Compilation of WordPress Code

Here are the snippets of code I’ve managed to collect. If you have any WordPress code you’d like me to add, please leave a comment below![Some code I think uesed seldom is deleted,and the article is edited by chenshian]

Display Archives

<h2>Archives</h2>
<ul>
<?php db_get_archives('type=monthly'); ?>
</ul>

Display Admin Section

<ul>
<?php db_register(); ?>
<li><?php db_loginout(); ?></li>
<li><a href="http://www.wordpress.org/">WordPress</a></li>
<?php db_meta(); ?>
<li><a href="http://validator.w3.org/check?uri=referer">XHTML</a></li>
</ul>

Display WordPress Tags

<?php the_tags(); ?>

Display WordPress Tags Cloud

<?php db_tag_cloud('smallest=8&largest=36&'); ?>

Template Name

This allows you to use the WordPress page template to customize how a page is displayed:

<?php /* Template Name: Portfolio */ ?>

Display PHP on a Single Page

Allows you to display plugins and such on a single page (replace home with the page you want it to only appear on):

<?php if ( is_home() ) { include ('file.php'); } ?>

I’m expecting this list to grow over time as I come across more useful WordPress code and update the post.

FROM:http://hackwordpress.com/huge-compilation-of-wordpress-code/

↓如果你有兴趣,可以从这里阅读更多相关的文章↓

此条目发表在 消遣 分类目录,贴了 标签。将固定链接加入收藏夹。