/*
Plugin Name: Custom Smilies Src
Plugin URI: http://fairyfish.net/m/custom_smilies_src/
Description: Custome Smiles Src
Version: 0.1
Author: Denis
Author URI: http://fairyfish.net/
*/
add_filter('smilies_src','custom_smilies_src',1,10);
function custom_smilies_src ($img_src, $img, $siteurl){
return $siteurl.'/wp-content/smilies/'.$img;
}
WordPress 技巧:自定义 WordPress 表情图片路径
28
August
2010
2
WordPress 技巧:在日志下添加作者头像和版权申明
28
August
2010
<?php
/*
Plugin Name: 版权申明
Plugin URI: http://fairyfish.net/m/copyright/
Description: 在日志下面添加版权申明
Version: 0.1
Author: Denis
*/
function post_copyright(){
if(is_single()){
global $post,$authordata;
?>
<div id="copyright">
<?php echo get_avatar($authordata->ID,'55');?>
<p>作者:<a href="<?php echo $authordata->user_url; ?>" title="<?php echo $authordata->display_name;?>"><?php echo $authordata->display_name;?></a><br />
原文链接:<a href="<?php echo get_permalink($post->ID);?>" title="<?php echo $post->post_title; ?>"><?php echo $post->post_title; ?></a><br />
<a href="<?php bloginfo('url');?>" title="<?php bloginfo('name');?>"><?php bloginfo('name');?></a>版权所有,请勿转载本博客日志到任何博客或论坛。</p>
</div>
<?php
}
}
add_filter('the_content','post_copyright_content');
function post_copyright_content($text){
ob_start();
post_copyright();
$post_copyright_content = ob_get_contents();
ob_end_clean();
return $text.$post_copyright_content;
}
?>
Wordpress 最新、热评、随机日志函数三体合一
27
August
2010
function get_posts($orderby = '', $plusmsg = '') {
$get_posts = query_posts('posts_per_page=10&caller_get_posts=1&orderby='.$orderby);
foreach ($get_posts as $get_post) {
$output = '';
$post_date = mysql2date('y年m月d日', $get_post->post_date);
$commentcount = '('.$get_post->comment_count.' 条评论)';
$post_title = htmlspecialchars(stripslashes($get_post->post_title));
$permalink = get_permalink($get_post->ID);
$output .= '<li><a href="' . $permalink . '" title="'.$post_title.'">' . $post_title . '</a>'.$$plusmsg.'</li>';
echo '<ul>'.$output.'</ul>';
}
wp_reset_query();
}
<?php //最新日志 get_posts( $orderby = 'date', $plusmsg = 'post_date' ); //热评日志 get_posts( $orderby = 'comment_count', $plusmsg = 'commentcount' ); //随机日志 get_posts( $orderby = 'rand', $plusmsg = 'post_date' ); ?>
via:http://wange.im/recent-comments-rand-posts-in-one.html
<?php
function some_posts($before = '<li> ', $after = '</li>') {
//最新文章
$some_posts = query_posts('posts_per_page=10&caller_get_posts=1');
//随机文章
$some_posts = query_posts('posts_per_page=10&caller_get_posts=1&orderby=rand');
//热评文章
$some_posts = query_posts('posts_per_page=10&caller_get_posts=1&orderby=comment_count');
foreach (some_posts as $post) {
$output = '';
$post_title = htmlspecialchars(stripslashes($post->post_title));
$permalink = get_permalink($post->ID);
$output .= $before . '<a href="' . $permalink . '" rel="bookmark" title="';
$output .= '">' . $post_title . '</a>'.$after;
echo $output;
}
}
?>
http://wancheng.li/1452.html