XF 2.2 New thread button color for each node page

Nicolas FR

Well-known member
Hello,

I want to change the New Thread button for each forum nodes in a category. I was successful with this code for one node
Less:
[data-container-key="node-69"] {
    .button.button--cta, a.button.button--cta {
        background: rgb(0, 157, 220);
        border-color: rgb(0, 157, 220);
    }
    .button.button--cta, a.button.button--cta:hover {
        background: rgb(0, 146, 204);
        border-color: rgb(0, 157, 220);
    }
}
I've got a lot of nodes do i have to repeat this code for each node or there is a tips to go faster ? like this...
Less:
[data-container-key="node-69+node-70+node-83+etc..."] {
    .button.button--cta, a.button.button--cta {
        background: rgb(0, 157, 220);
        border-color: rgb(0, 157, 220);
    }
    .button.button--cta, a.button.button--cta:hover {
        background: rgb(0, 146, 204);
        border-color: rgb(0, 157, 220);
    }
}

Thanks ! :)
 
Solution
Less:
[data-container-key="node-2"],
[data-container-key="node-10"]
{
    .button.button--cta, a.button.button--cta {
        background: rgb(0, 157, 220);
        border-color: rgb(0, 157, 220);
    }
    .button.button--cta, a.button.button--cta:hover {
        background: rgb(0, 146, 204);
        border-color: rgb(0, 157, 220);
    }
}
Less:
[data-container-key="node-2"],
[data-container-key="node-10"]
{
    .button.button--cta, a.button.button--cta {
        background: rgb(0, 157, 220);
        border-color: rgb(0, 157, 220);
    }
    .button.button--cta, a.button.button--cta:hover {
        background: rgb(0, 146, 204);
        border-color: rgb(0, 157, 220);
    }
}
 
Solution
This is why I think Xenforo is designed so well.
I just had a question that was helped by community members and staff. :)
Then I was recommended other threads that kind of fit what I was asking a question about. This was one of the threads, and I'm so glad I clicked on it, cause it's exactly what I needed big time. Great Job with xenforo 2, cause it is amazing.
This makes it so I do not have to keep duplicating codes.
 
The code in my post above can also be written like so:

Less:
[data-container-key="node-2"],
[data-container-key="node-10"]
{
    .button.button--cta, a.button.button
    {
        &--cta
        {
            background: rgb(0, 157, 220);
            border-color: rgb(0, 157, 220);
        }

        &:hover
        {
            background: rgb(0, 146, 204);
            border-color: rgb(0, 157, 220);
        }
    }
}

Or this:
Less:
[data-container-key="node-13"],
[data-container-key="node-36"]
{
    .button.button--cta, a.button.button--cta
    {
        background: rgb(0, 157, 220);
        border-color: rgb(0, 157, 220);

        &:hover
        {
            background: rgb(0, 146, 204);
            border-color: rgb(0, 157, 220);
        }
    }
}
 
The code in my post above can also be written like so:

Less:
[data-container-key="node-2"],
[data-container-key="node-10"]
{
    .button.button--cta, a.button.button
    {
        &--cta
        {
            background: rgb(0, 157, 220);
            border-color: rgb(0, 157, 220);
        }

        &:hover
        {
            background: rgb(0, 146, 204);
            border-color: rgb(0, 157, 220);
        }
    }
}

Or this:
Less:
[data-container-key="node-13"],
[data-container-key="node-36"]
{
    .button.button--cta, a.button.button--cta
    {
        background: rgb(0, 157, 220);
        border-color: rgb(0, 157, 220);

        &:hover
        {
            background: rgb(0, 146, 204);
            border-color: rgb(0, 157, 220);
        }
    }
}
Thank you, will be bookmarking this......
 
Top Bottom