Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vdchristelle/6492499 to your computer and use it in GitHub Desktop.
Save vdchristelle/6492499 to your computer and use it in GitHub Desktop.
nieuwsitems uitvullen als er geen foto geupload is met jQuery of in preprocess_html()
$(document).ready(function() {
//optie 1
$('.sidebar-menu').find('li.active').next().addClass('nextitem');
$('.mainmenu').find('li.active').next().addClass('nextitem');
//if news has no image, add extra classes
if ( $('.node-nieuws-item .group-left .group_testimonial_img').length == 0) {
$('.node-nieuws-item .group-left').addClass('hide');
$('.node-nieuws-item .group-right').addClass('width_100');
} else { alert('banan'); };
//optie 2 lists
$('.overview.news li').each(function(){
if ($(this).find('.news-image').length == 0) {
$(this).find('.editor').addClass('width_100');
}
});
}); // end document.ready
function YOURTHEME_preprocess_html(&$variables) {
// add no photo class
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
switch ($node->type) {
case 'page':
if (empty($node->field_image)) {
$variables['classes_array'][] = 'no-photo';
}
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment