![]() |
Where to edit styles for media - gallery in wordpress?
hey guys,
i was wonder.. what if i want to add my own style to photos inside wordpress posts? no problem when i'm using standard html line: <a href="image url"><img src"thumb url"></a> with my style it will look like this: <a href="image url" class="my style"><img src"thumb url"></a> but what if all my posts are media - gallery like here: [gallery link="file" ids="2269,2268,2267,2266,2265,2264,2263,2262"] where can i add my styles there? |
In the gallery plugin where it renders the images or in its css depending on what you want to do and which gallery you are using.
|
using standard one gallery which is built in wordpress.
do you know exactly where can i edit it? if it would be plugin for gallery that i'm using i would normally go to plugins/edit but it's not so that's why i'm looking my way into it. |
Oh. I though you were using a WordPress gallery plugin like NextGen Gallery or Photo Gallery.
You'll need to do something like this then: zurb foundation - Change Wordpress default gallery output - Stack Overflow And you should do it in a child theme. |
appears i'm to dumb to do this using code they are tweaking on the site you linked to.
so to add style - simple style to standard wordpress gallery i need to do this in functions.php in child theme of my WP? can you show me a bit how to do this in functions and not to fuck it up? not like i won't try myself but you can speed up if you know where to exactly i should paste my damn class="mystyle" (that's example ofc). and thanks for trying help, appreciate. |
Use a Child Theme
Quote:
On the style sheet for your child theme, place your CSS code. Hope this helps. |
Quote:
Read this: https://codex.wordpress.org/Child_Themes I could do it for you if you wish or tell you how it can be achieved based on your setup. Contact me. |
Quote:
Myleene: pm sent, thanks. |
Quote:
I have two clients whose templates didn't have a child theme and I need to create it to do updates. Thanks! |
fucking done it, google is the king ;)
thanks for all the helps guys, if anyone wanna know how to add style to href tag inside gallery, pm me. |
i know you already solved it, but every wordpress gallery starts with an ID with a class 'gallery'. You can simply override the default styles by adding a new style to your css file
.gallery a { } or gallery img { } I do that and it does the job really good ;) Hope it helps ;) z |
thanks for the tip.
this code added to functions.php solved my problem: function my_get_attachment_link($html) { $postid = get_the_ID(); $html = str_replace('<a', '<a class="mystyle"', $html); return $html; } add_filter('wp_get_attachment_link', 'my_get_attachment_link', 10, 1); |
I hope you did that in a child theme or all of your changes go poof on an update.
|
ofc :thumbsup
|
All times are GMT -7. The time now is 02:45 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123