2013-03-24 54 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