Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

My own CSS class name for any element?

Open magisterson opened this issue 9 years ago • 18 comments

Hello!

Is there any way to add my own class/id name for element (section, image, text block etc.)? I know the solution to ad CSS ID like here:

SOLUTION and then we get for example:

<section id="shortcode-1fae6def1db2d0519b7e1e26d04f4a5a">

But this is dynamic ID so if I want to create onther page for example "ABOUT US" and use the same ID I can't because new section has different ID numbers. It's lillte irritating because I need to add all ID's to my style.css document if I want to use one style for few sections.

Then my CSS document looks like this:

#shortcode-d3a2b1b6eec4ee6f046c1f6e85fb4485, #shortcode-11a2b1b6eec4ee45676c1f6e85fb9997, #shortcode-189e1844c4e89da6e72c6a9983473bf9, #shortcode-0b23b02b18d444b1da33a35eaf57f88e, shortcode-1fae6def1db2d0519b7e1e26d04f4a5a{ color:#000; ... ... }

And then if I'll create new section I need to add next ID to STYLE.css to use same style. It would be nice to have possibillity to add own class or id in backend for example "my_class". Then css code could be look like this:

.my_class{ color:#000; ... ... }

And during creating new section I could add just my class to include style. Is there any option to get this functionallity?

magisterson avatar Sep 08 '17 14:09 magisterson

Like this??? capture

gigit95 avatar Sep 08 '17 18:09 gigit95

YES! Beautiful! How you get this?

magisterson avatar Sep 08 '17 18:09 magisterson

Wait a little bit, I'll show you. What do you use as theme? Child theme??

gigit95 avatar Sep 08 '17 18:09 gigit95

You mean main WP theme? It's "twenty seventeen"

magisterson avatar Sep 08 '17 18:09 magisterson

Try this... go to yourSite\wp-content\plugins\unyson\framework\extensions\shortcodes\shortcodes copy folder "section" paste it into - yourSite\wp-content\themes\yourTheme\framework-customizations\extensions\shortcodes\shortcodes
if you don't have these folders you have to create them... In pasted folder, you must to modify options.php and views/view.php I'll take some screen-shots for you wait a bit. Hope this will help I'm a beginner too. P.S. To modify a theme, it's better to use a child theme.

gigit95 avatar Sep 08 '17 19:09 gigit95

1dfgdfxg

wdfgf

go into pasted folder open optons.php fthfghdfgth

then go to the folder views and open view.php htgfhfgh

I hope it will help you

gigit95 avatar Sep 08 '17 19:09 gigit95

Thanks. I gonna check this sollution tomorrow. THANKS A LOT. I'll give you answer how it's work later :)

magisterson avatar Sep 08 '17 19:09 magisterson

https://www.dropbox.com/s/2byhtydgzaag9zm/section.rar?dl=0

I've "zipped" my section folder if you want to use it. By the way, you can do the same with others elements too

gigit95 avatar Sep 08 '17 19:09 gigit95

Thank you sooo much :)

But I have only one question more. You told me that it's better to use child-theme. I know updates etc. But it is not better way to make a copy/clone of default theme and then make modifications? It will protect me before theme updating? Updates are forced automaticly or only manualy? I found simple plugin to make duplicate of any theme by one click: https://wordpress.org/plugins/duplicate-theme/

magisterson avatar Sep 08 '17 19:09 magisterson

I'm using a "Starter theme" from https://underscores.me. May be "duplicate theme" is a better way. But if you have an update of your parent theme, I think it gonna destroy your site. As I sad I'm a beginner so... sorry bro I can't give a good answer. This starter theme is realy good, it's an empty theme, and you can build you own theme from it. Sorry for my bad English.

gigit95 avatar Sep 08 '17 19:09 gigit95

that dropbox blocked php files try google drive link... https://drive.google.com/open?id=0B-o9yzKrZip1NmJXRTNSQnEzaG8

gigit95 avatar Sep 08 '17 19:09 gigit95

Did you read this from your link ... "This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress." I think it's a bad idea, to use old plugins. And if you want to have a real control of your site, you have to use FTP and do, at least some minimum, coding. Like me copy-paste ;)

gigit95 avatar Sep 08 '17 20:09 gigit95

I know it's old. But there are lot of similar plugins like this one: https://wordpress.org/plugins/theme-duplicator/#description it was just an example.

magisterson avatar Sep 08 '17 20:09 magisterson

I don't know, if you want to use a plugin it's not a problem. I just usually try to use less plugins possible. Any way if you want use Unyson, you goona have a deal with coding ( just like this little problem with classes). So, I think it's better to do the same thing that these plugins do with you hands (manually - creating folder childTheme etc.). It's my opinion.

gigit95 avatar Sep 08 '17 20:09 gigit95

Don't worry friend I creating websites since 1999 but we never used WP. We creating websites on our CMS but our last customer using UNYSON. I'am not a programmer so I decided to ask support how to add this funcionallity to UNYSON. I was thinking that maybe is't some hidden option. Before I was using this solution as I said:

http://manual.unyson.io/en/latest/extension/shortcodes/index.html#enqueue-shortcode-dynamic-css-in-page-head

But it's very bad because it's dynamic ID. I hope in future YNYSON provide this funcionallity :)

magisterson avatar Sep 08 '17 20:09 magisterson

I've thought u're a beginner like me :) . Yes, may be some day someone will add these lines of code in Unison installer. But the force of Unyson is that you can customise it by touching the code. Here you can ask questions and get answers. Devs of Unison try to make it better and better. It's still young plugin-framework and it have a potential. Good luck to you !

gigit95 avatar Sep 08 '17 20:09 gigit95

You right :) I'am a beginer in some things :P I am a graphic designer and buzz marketing specialist in my agency, i Know good HTML/CSS but i know only basics in PHP. We have friday night and my co-worker (programmer) is now spleaping and I am alone with this problem :D I have to much thank you for your help. Thanks to you I will be able to go sleep soon (first time from few weeks) :D

magisterson avatar Sep 08 '17 21:09 magisterson

If you download the zip file, in views folder there are 2 files - view.php and view0000.php. The second is a backup, so you can compare 2 files to see the changed code.

P.S. And if you solved the problem, it's better to close this issue.

gigit95 avatar Sep 08 '17 23:09 gigit95