PDA

View Full Version : [SOLVED] Add css code in additional.css Template by plugin


omardealo
11-07-2016, 10:43 AM
i want add css code in additional.css Template , but my code dose not work

hook : parse_templates
code :
$csscode = '.threadlisthead span.threadinfo {
width: 48%;
}
.threadbit .threadinfo {
width: 48%;
}';
$vbulletin->templatecache['additional.css'] .= '$csscode';

MarkFL
11-07-2016, 11:29 AM
What I would do instead is at that same plugin hook, use the code:

if (THIS_SCRIPT === 'forumdisplay')
{
$template_hook['headinclude_css'] .= '<style>.threadlisthead span.threadinfo, .threadbit .threadinfo {width: 48%;}</style>';
}

omardealo
11-07-2016, 11:54 AM
What I would do instead is at that same plugin hook, use the code:

if (THIS_SCRIPT === 'forumdisplay')
{
$template_hook['headinclude_css'] .= '<style>.threadlisthead span.threadinfo, .threadbit .threadinfo {width: 48%;}</style>';
}

what is name of hook u use it ??

MarkFL
11-07-2016, 11:57 AM
The same hook you were already using: parse_templates

omardealo
11-07-2016, 11:59 AM
The same hook you were already using: parse_templates

okay thanks bro , but it is not work :erm:

MarkFL
11-07-2016, 12:02 PM
You may need to add "!important" to your selector's CSS declaration. :)

omardealo
11-07-2016, 12:05 PM
You may need to add "!important" to your selector's CSS declaration. :)

I do not understand Can you explain
thanks :up:

MarkFL
11-07-2016, 12:08 PM
Change the plugin code to:

if (THIS_SCRIPT === 'forumdisplay')
{
$template_hook['headinclude_css'] .= '<style>.threadlisthead span.threadinfo, .threadbit .threadinfo {width: 48% !important;}</style>';
}

This way it will override any other normal selectors pertaining to those elements.

omardealo
11-07-2016, 12:16 PM
Change the plugin code to:

if (THIS_SCRIPT === 'forumdisplay')
{
$template_hook['headinclude_css'] .= '<style>.threadlisthead span.threadinfo, .threadbit .threadinfo {width: 48% !important;}</style>';
}

This way it will override any other normal selectors pertaining to those elements.

Okay bro it is works good now
thanks alot :up::up: