The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Topic's Entry Content Different Design in Spesific Category

Go down

In progress Topic's Entry Content Different Design in Spesific Category

Post by J0k3R^ on December 6th 2014, 1:16 pm

Hi. I would like to change the topic's entry contents codes (.pun .entry-content) in some categories like "news" etc but in rest categories to be normal-default settigs.
Can we do that? Smile

avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

In progress Re: Topic's Entry Content Different Design in Spesific Category

Post by Ange Tuteur on December 6th 2014, 8:54 pm

Hello J0k3R^,

See if this works :
Administration Panel > Modules > JavaScript codes management > Create a new script

Title : Your choice
Placement : In the topics
Paste the code below :
Code:
$(function() { if (!$('.nav').length) return;
  catPost(1, 'category1');
  catPost(2, 'category2');
  
  function catPost(category, name) {if (Number($('a.nav[href^="/c"]:first').attr('href').replace(/\/c(\d+)-.*/,'$1')) == category) $('.post').addClass(name)}
});

To set a class for posts in a certain category simply copy and paste catPost('category', 'name'); in the script above.

category : This is the category ID that you want the script to take effect in. You can see it from the URL : fmplanet.forumgreek.com/c1-category

name : This is the classname you want to add to posts, so you can style them via your CSS stylesheet.

For example if I give the posts the class of 'category1' I could do something like this in my stylesheet :
Code:
.post.category1 .postbody {
  background:red
}
avatar
Ange Tuteur
Forumaster

Male Posts : 13194
Reputation : 2906
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

In progress Re: Topic's Entry Content Different Design in Spesific Category

Post by J0k3R^ on December 6th 2014, 9:15 pm

Hm i followed everything u said but i didnt see the background to be red in 1st category. 
To make it more specific, i'd like to affect the /f5-forum and /f6-forum instead.
avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

In progress Re: Topic's Entry Content Different Design in Spesific Category

Post by Ange Tuteur on December 6th 2014, 9:23 pm

Replace your script with this :
Code:
$(function() { if (!$('.nav').length) return;
  catPost(5, 'forum5');
  catPost(6, 'forum6');
 
  function catPost(category, name) {if (Number($('a.nav[href^="/f"]:first').attr('href').replace(/\/f(\d+)-.*/,'$1')) == category) $('.post').addClass(name)}
});
avatar
Ange Tuteur
Forumaster

Male Posts : 13194
Reputation : 2906
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

In progress Re: Topic's Entry Content Different Design in Spesific Category

Post by J0k3R^ on December 6th 2014, 10:19 pm

Hm okey now its working but my settings affect more things (Likes + Edit).
Is it possible to declare something or do any other changes so only the topic's text will be affected?

avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

In progress Re: Topic's Entry Content Different Design in Spesific Category

Post by Ange Tuteur on December 6th 2014, 10:24 pm

Have you tried .post.forum5 .entry-content div div ?
avatar
Ange Tuteur
Forumaster

Male Posts : 13194
Reputation : 2906
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

In progress Re: Topic's Entry Content Different Design in Spesific Category

Post by J0k3R^ on December 7th 2014, 7:38 am

nice thumleft
one more thing? if we could make it change style only for 1st post of the topics?
avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

In progress Re: Topic's Entry Content Different Design in Spesific Category

Post by Ange Tuteur on December 7th 2014, 5:33 pm

See if this works :
Code:
.post.forum5:first-child .entry-content div div
avatar
Ange Tuteur
Forumaster

Male Posts : 13194
Reputation : 2906
Language : EN10, FR5, JA5
Location : Macungie, PA

https://github.com/SethClydesdale

Back to top Go down

In progress Re: Topic's Entry Content Different Design in Spesific Category

Post by J0k3R^ on December 7th 2014, 6:53 pm

didnt work
avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum