View Single Post
Old 02-15-2015, 03:05 AM  
just a punk
So fuckin' bored
 
just a punk's Avatar
 
Industry Role:
Join Date: Jun 2003
Posts: 32,365

Quote:
Originally Posted by AdultSites View Post
Find it in the database, and change it there.
Never even touch the WP database directly! Use API to alter it. In this particular case, you need to go through all existing posts, find the gallery shortcodes there and alter them according to this scheme:

[gallery] - linked to attachment
[gallery link="file"] - linked to file
[gallery link="none"] - not linked

Let's consider that all your gallery thumbnails are linked to attachments and you want to make them liked to the actual images. In other words, you have to replace this:

[gallery]

with this:

[gallery link="file"]

I'll show how to do it with the CyberSEO plugin, which almost all GFY's already have.
  1. Go to "CyberSEO->Tools"
  2. Find the "PHP Code <?php .. ?>" box and put there the following code:
  3. Code:
    $post->post_content = str_replace('[gallery]', '[gallery link="file"]', $post->post_content);
  4. Click "Apply These Modifications To All Existing Posts"
  5. Done!

If you want to do the opposite (i.e. make all the thumbnails to link to attachments instead of original images), you should use this code in step #3:

Code:
$post->post_content = str_replace('[gallery link="file"]', '[gallery]', $post->post_content);
Very simple, isn't it? And no special plugins needed
__________________
Obey the Cowgod
just a punk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote