站点图标 度崩网-几度崩溃

给wordpress文章图片添加Auto-highslide灯箱预览效果

操作步骤:

1、下载auto-highslide集成包包:highslide

highslide

2、把下载的压缩包解压后的highslide文件夹通过FTP上传到 wp-content/themes/当前使用主题名称/ 目录;

3、编辑当前主题的Footer.php文件,在合适的位置添加引用代码:

 if(is_single()):?>
<link rel="stylesheet" href="/highslide/highslide.css" type="text/css" />
<script type="text/javascript" src="/highslide/highslide.js">script>
<script type="text/javascript">
jQuery(document).ready(function($) {
    hs.graphicsDir = "/highslide/graphics/";
    hs.outlineType = "rounded-white";
    hs.dimmingOpacity = 0.8;
    hs.outlineWhileAnimating = true;
    hs.showCredits = false;
    hs.captionEval = "this.thumb.alt";
    hs.numberPosition = "caption";
    hs.align = "center";
    hs.transitions = ["expand", "crossfade"];
    hs.addSlideshow({
        interval: 5000,
        repeat: true,
        useControls: true,
        fixedControls: "fit",
        overlayOptions: {
            opacity: 0.75,
            position: "bottom center",
            hideOnMouseOut: true

        }

    });
});
script>
 endif;?>

4、编辑当前主题的functions.php文件,在

//集成auto-highslide灯箱插件  by www.qyblog.cn
add_filter('the_content', 'addhighslideclass_replace');
function addhighslideclass_replace ($content)
{   global $post;
	$pattern = "/]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\/a>/i";
    $replacement = '$7';
    $content = preg_replace($pattern, $replacement, $content);return $content;
}

5、上传图片的时,“附件显示设置”中的“链接到”选择“媒体文件”再插入文章,然后文章中的图片点击就会有灯箱效果