I want to use built-in WP media gallery. I’m trying to simply add images in one – horizontal line. I want images with original size and without any link. I’m trying to add/edit some code into wp-admin/includes/media.php but I can’t get it ;/ I know I have to use size=”full” and columns=”0″ but how to add this with shortcode as default? And I have no idea how to get rid of links under images? Am I looking in good file? If no – point me to right direction please 😉
Leave a Reply
You must be logged in to post a comment.
UPDATE
I’ve just submitted a core patch to add
link="none"
support to the[gallery]
shortcode.ORIGINAL ANSWER
You don’t need to hack core to do what you want to do; just use the appropriate
[gallery]
shortcode parameters, e.g.:If you want to change the defaults, then use the
post_gallery
filter:The only way to remove the link is to clear the image link field in the Media Library, or you can do some involved code replacement.
EDIT
I’m somewhat guessing here, as I’m not fully familiar with filtering the gallery output. I’ve made a couple of modifications, including passing both variables to the callback, correcting the
add_filter()
call to accommodate both variables, and returning$output
rather than$attr
.EDIT 2
Okay, so it looks like, currently, the only way to override th shortcode attributes is to rewrite the entire walker. See this Trac Ticket for details.
So, basically, this:
No
Use Gallery shortcode.
link
you can set it to “file” so each image will link to the image file. The default value links to the attachment’s permalink.
include
comma separated attachment IDs, [gallery include="23,39,45"] will show only the images from these attachments.
exclude
comma separated attachment IDs, [gallery exclude="21,32,43"] excludes the images from these attachments. Please note that include and exclude cannot be used together.
Insert your photo, click on the image, click on the photo (Edit image) icon that appears on top of your photo, then when the EDIT PHOTO box opens, scroll down and click NONE under the link photo option.
Hope this helps.
Alternate approach: use the Cleaner Gallery Plugin.