Source: Xenforo Official Community
Out of the box, there is no specific thread criterion for notices.
However, it's very simple to achieve.
Step 1
Create the notice as follows:
Here I am using a custom CSS class name of ctaThread3 in the Message div and the Display styling: Other, using a custom CSS class name field.
You can name yours whatever you wish but ensure it is unique and doesn't clash with any other classes and is the same in both locations.
You can omit the notice--primary from the display styling field if you want to completely customize the appearance of the notice.
Step 2
Then, in the extra.less template add this:
Change the 3 in the [data-content-key="thread-3"] line to the actual thread ID.
Make sure you keep the entries in that order and that the ctaThread3 class name matches what you used in the notice.
Apply any custom styling after the display: block; line as required, for example.:
Less:
That's it!
If you want to show the notice in more than one thread, enter additional data elements, like so:
You can even use different data elements - this will show the notice in two different threads, and one forum:
The same approach can be used for any page that has a unique
The key can be obtained using the browser inspector (F12) and checking the <html ... > line.
If you found this tutorial useful, donations of positive emojis are gladly received.
Out of the box, there is no specific thread criterion for notices.
However, it's very simple to achieve.
Step 1
Create the notice as follows:
Here I am using a custom CSS class name of ctaThread3 in the Message div and the Display styling: Other, using a custom CSS class name field.
You can name yours whatever you wish but ensure it is unique and doesn't clash with any other classes and is the same in both locations.
You can omit the notice--primary from the display styling field if you want to completely customize the appearance of the notice.
Step 2
Then, in the extra.less template add this:
CSS:
.ctaThread3
{
display: none;
}
[data-content-key="thread-3"]
{
.ctaThread3
{
display: block;
}
}
Change the 3 in the [data-content-key="thread-3"] line to the actual thread ID.
Make sure you keep the entries in that order and that the ctaThread3 class name matches what you used in the notice.
Apply any custom styling after the display: block; line as required, for example.:
Less:
CSS:
[data-content-key="thread-3"]
{
.ctaThread3
{
display: block;
color: orange;
font-weight: 600;
}
}
If you want to show the notice in more than one thread, enter additional data elements, like so:
You can even use different data elements - this will show the notice in two different threads, and one forum:
The same approach can be used for any page that has a unique
[data-...]
key, such as a specific forum -- data-container-key="node-1" --
or resource category -- data-container-key="xfrmCategory-43"
.The key can be obtained using the browser inspector (F12) and checking the <html ... > line.
If you found this tutorial useful, donations of positive emojis are gladly received.
Last edited: