GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Where to edit styles for media - gallery in wordpress? (https://gfy.com/showthread.php?t=1166813)

druid66 05-17-2015 08:30 AM

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?

myleene 05-17-2015 08:34 AM

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.

druid66 05-17-2015 08:46 AM

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.

myleene 05-17-2015 09:29 AM

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.

druid66 05-17-2015 11:47 AM

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.

SlickTz 05-17-2015 12:18 PM

Use a Child Theme
 
Quote:

Originally Posted by druid66 (Post 20476360)
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.

You should probably set up a child theme. I use the WP plugin: One-click Child Theme

On the style sheet for your child theme, place your CSS code. Hope this helps.

myleene 05-17-2015 12:31 PM

Quote:

Originally Posted by druid66 (Post 20476360)
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.

It's advanced WordPress, it requires more than 5-10 minutes to achieve and it requires good understanding of your setup. I wouldn't try it directly on a live blog as it could break it.

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.

druid66 05-17-2015 01:15 PM

Quote:

Originally Posted by SlickTz (Post 20476375)
You should probably set up a child theme. I use the WP plugin: One-click Child Theme

On the style sheet for your child theme, place your CSS code. Hope this helps.

i know i can setup my own theme, but i'm tweaking already good theme now i want photos to be displayed in the way i want it.

Myleene: pm sent, thanks.

kristin 05-17-2015 01:20 PM

Quote:

Originally Posted by SlickTz (Post 20476375)
You should probably set up a child theme. I use the WP plugin: One-click Child Theme

On the style sheet for your child theme, place your CSS code. Hope this helps.

Thanks for that plugin. :)

I have two clients whose templates didn't have a child theme and I need to create it to do updates. Thanks!

druid66 05-17-2015 01:42 PM

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.

zerovic 05-17-2015 03:29 PM

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

druid66 05-17-2015 04:10 PM

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);

Babaganoosh 05-17-2015 11:20 PM

I hope you did that in a child theme or all of your changes go poof on an update.

druid66 05-18-2015 12:05 AM

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