2013-03-24 56 views
0

我无法让Lightbox Plus Colorbox插件在我创建的wordpress主题上工作。我按照步骤安装插件 -灯箱不能在Wordpress网站上工作

  1. 将lightbox-plus.zip提取到您的wp-content/plugins目录。
  2. 在插件下的管理面板中激活Lightbox Plus ColorBox。
  3. 在外观下的管理面板中,点击Lightbox Plus ColorBox以配置您的喜好。
  4. 现在应该完全建立并正常

然而,这是不是功能。当我点击帖子中的图片时,它会将观看者带到新页面。我完全被难住了。我的JavaScript非常薄弱,我很乐意帮助我完成这项工作!

<div style="background-color:#383838; padding:15px 0px; width:auto;"> 
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> 

     <div class="entry"> 
     <h2 class="background_header"><?php the_title(); ?></h2> 

     <?php the_content(); ?> 
     </div>   
    </div> 

<?php endwhile; endif; ?> 

回答

1

很可能是因为你没有相对= “收藏夹[ID |名称]” 你的IMG链接。

在您的主题中,将其添加到您的functions.php文件中。

添加的ID,并把它们分开

add_filter('the_content', 'add_lightbox_rel'); 
function add_lightbox_rel($content) { 
     global $post; 
     $get_img ="/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i"; 
     $img_replace = '<a$1href=$2$3.$4$5 rel="lightbox['.$post->ID.']" title="'.$post->post_title.'"$6>'; 
     $content = preg_replace($get_img, $img_replace, $content); 
     return $content; 
} 
+0

喜@robert李,我这样做,并没有做任何事情。该图像只是在第二页中打开 – jennetcetera 2013-03-31 20:13:41

+0

您可以参考一个网站,以便我们可以查看并查看是否有其他错误? rel =显示所有图像?有很多因素需要考虑.. – 2013-03-31 22:57:22