The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
2 posters

    Topic's Entry Content Different Design in Spesific Category

    J0k3R^
    J0k3R^
    Forumember


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

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

    Post by J0k3R^ 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

    Topic's Entry Content Different Design in Spesific Category ZnwYZ9l
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

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

    Post by Ange Tuteur 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
    }
    J0k3R^
    J0k3R^
    Forumember


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

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

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

    Hm i followed everything u said but i didnt see the background to be red in 1st category. Topic's Entry Content Different Design in Spesific Category 3736479084
    To make it more specific, i'd like to affect the /f5-forum and /f6-forum instead.
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

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

    Post by Ange Tuteur 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)}
    });
    J0k3R^
    J0k3R^
    Forumember


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

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

    Post by J0k3R^ 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?

    Topic's Entry Content Different Design in Spesific Category RL4XndK
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

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

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

    Have you tried .post.forum5 .entry-content div div ?
    J0k3R^
    J0k3R^
    Forumember


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

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

    Post by J0k3R^ 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?
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

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

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

    See if this works :
    Code:
    .post.forum5:first-child .entry-content div div
    J0k3R^
    J0k3R^
    Forumember


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

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

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

    didnt work

      Current date/time is September 22nd 2024, 8:27 pm