Hi,
I want to override the view of my elgg just for the custom index. There I want to set:
.elgg-page-default .elgg-page-body>.elgg-inner {
width: 100%;
}
But on all other pages the default width should be set. Can someone tell me how to do that?
Cheerz
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Per Jensen@gillie
Per Jensen - 0 likes
- Hanzolo@Hanzolo
Hanzolo - 0 likes
- Per Jensen@gillie
Per Jensen - 0 likes
- Hanzolo@Hanzolo
Hanzolo - 0 likes
You must log in to post replies.Use a plugin hook to add a body class when in context front:
Thank you Per. Sorry that I have to ask more precisely as I am pretty much of a beginner.
Let's say I modify the custom_index plugin for example. Then I have to put
if (elgg_in_context('front')){
elgg_register_plugin_hook_handler('output:before', 'page', 'my_body_attrs');
}
function my_body_attrs($hook, $type, $value, $params) {
$value['body_attrs'] = array('class' => 'elgg-front-page');
return $value;
}
into custom_index/views/default/page/layouts/custom_index.php
The css style comes into my css file. But I will have to set the context somewhere then. Like this?
$context = elgg-front-page;
You should not edit Elgg or bundled plugins. Instead, you must add a custom plugin to contain all your changes, like the one you are about to make. You can download a plugin skeleton here: elgg_child_theme.
Plugin custom index does set the context, so don't worry about that - elgg_push_context('front').
You shouldn't check for context in the init function, so in your custom plugin add an event handler and add the context check there:
Add the rest mentioned previously. The class .elgg-front-page will be added to the <body> tag, you can name it anything you like.
Keep the custom plugin at the bottom of the plugin list.
Got it, thank you!