I'm new to wordpress and I would like to learn how to adjust certain small things. For example I would like to change a gallery. Currently the caption is shown when I hover over the picture. Know I would like to change it to, when hovering it should show a magnifier.

I know a little css, html and php. But I somehow always have troubles to make the next step. It always gets so fast, so complicated when trying to do some (what seems like) simple and usefully stuff. But I’m tired of asking other people to change such small things, have to wait,...

My question is, where and how do I find the code that controls the template gallery? So I can see the code, try to understand it and go from there or would you suggest a different path?

enter image description here

1 Answer 1


There are several possible things affecting your gallery. The first most basic one is WordPress Core itself. The gallery shortcode is created in /wp-includes/media.php. If you had a default theme and no plugins, that would be controlling it.

However, the behavior you describe is being added, either by a theme or a plugin. A theme is the most likely, so check there first. A likely spot would be in functions.php though it could be in some other file.

Finally, plugins can also override the default gallery behavior, so you may want to deactivate your plugins to confirm the behavior is coming from the theme.


If it's the theme, and you are not already using a child theme, you can create a child theme and override the current theme's behavior.

Or, if it's a plugin, you will probably just want to deactivate that plugin and go with the theme functionality - or again, create a child theme if you don't want your theme's functionality.

Finally, if it's the theme and you are already using a child theme, the only option is to edit the child theme itself. The problem there is if the authors ever release updates to the child theme and you update, you will lose your customization. So, this works best if you only have a parent theme, and can easily create your own child theme.

  • Hi Elaine, thx your for you reply! The gallery is added thru a theme and I'm using a child theme already. About the customizations I'm well aware of this and will only update if necessary. The things is, where do I look for the gallery?
    – Josef
    May 1, 2018 at 19:31
  • As mentioned above, functions.php would be a likely place to look. If you're using a text editor such as Notepad++ or SublimeText which lets you "find in files" you can search for "gallery" in your theme and you should be able to locate it fairly quickly.
    – WebElaine
    May 1, 2018 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.