与‘wordpress’有关的日志

Wordpress

Dianso 发表于 存檔備份 分类,标签: , ,浏览 :12 次
1

WordPress隐藏评论内容,管理员可见,和Easy2hide有的一拼!

function private_content($atts, $content = null)
{ if (current_user_can('create_users'))
return '' . $content . ''; return '只有闲的蛋疼的管理员才能看得到的蛋疼的评论'; }
add_shortcode('private', 'private_content');
add_filter('comment_text', 'do_shortcode');

via:http://dorabmon.com/htmls/1123.html

WordPress WordPress

Dianso 发表于 存檔備份 分类,标签: , , , ,浏览 :23 次
0
/*
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

Dianso 发表于 存檔備份 分类,标签: , , , ,浏览 :25 次
0
<?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

Dianso 发表于 存檔備份 分类,标签: , , ,浏览 :32 次
0
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